礼包码:更新指定礼包码
This commit is contained in:
@@ -34,6 +34,9 @@ export default class GiftCode extends BaseModel {
|
|||||||
@prop({ required: true, default: 0 })
|
@prop({ required: true, default: 0 })
|
||||||
codeLen: number; // 礼包码位数
|
codeLen: number; // 礼包码位数
|
||||||
|
|
||||||
|
@prop({ required: false, default: '' })
|
||||||
|
code: string; // 指定礼包码
|
||||||
|
|
||||||
@prop({ required: true, default: '' })
|
@prop({ required: true, default: '' })
|
||||||
remark: string; // 备注
|
remark: string; // 备注
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ export default class GiftCodeDetail extends BaseModel {
|
|||||||
for(let i = 0; i < count; i++) {
|
for(let i = 0; i < count; i++) {
|
||||||
insertArr.push({
|
insertArr.push({
|
||||||
giftId: giftCode.id, giftName: giftCode.name, generateType: giftCode.generateType,
|
giftId: giftCode.id, giftName: giftCode.name, generateType: giftCode.generateType,
|
||||||
code: genCode(giftCode.codeLen), usedNum: 0, createdBy: uid, updatedBy: uid
|
code: giftCode.code||genCode(giftCode.codeLen), usedNum: 0, createdBy: uid, updatedBy: uid
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let result = await GiftCodeDetailModel.insertMany(insertArr);
|
let result = await GiftCodeDetailModel.insertMany(insertArr);
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ export class CreateGiftCode {
|
|||||||
codeLen: number; // 礼包码位数
|
codeLen: number; // 礼包码位数
|
||||||
remark: string = ''; // 备注
|
remark: string = ''; // 备注
|
||||||
generateType: GIFT_GENERATE_TYPE; // 生成类型
|
generateType: GIFT_GENERATE_TYPE; // 生成类型
|
||||||
|
code: string = '';
|
||||||
|
|
||||||
constructor(obj: any) {
|
constructor(obj: any) {
|
||||||
this.name = obj.name;
|
this.name = obj.name;
|
||||||
@@ -177,6 +178,7 @@ export class CreateGiftCode {
|
|||||||
this.codeLen = obj.codeLen;
|
this.codeLen = obj.codeLen;
|
||||||
this.remark = obj.remark;
|
this.remark = obj.remark;
|
||||||
this.generateType = obj.generateType;
|
this.generateType = obj.generateType;
|
||||||
|
this.code = obj.code;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkParams() {
|
checkParams() {
|
||||||
@@ -191,6 +193,7 @@ export class CreateGiftCode {
|
|||||||
if(this.generateType != GIFT_GENERATE_TYPE.ONE_TO_MANY && this.generateType != GIFT_GENERATE_TYPE.ONE_TO_ONE) {
|
if(this.generateType != GIFT_GENERATE_TYPE.ONE_TO_MANY && this.generateType != GIFT_GENERATE_TYPE.ONE_TO_ONE) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if(this.code != undefined && !isString(this.code)) return false
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user