🐞 fix(后台): 创建礼包码没有类型

This commit is contained in:
luying
2023-06-30 19:12:08 +08:00
parent a689f86e71
commit 7222c5225f

View File

@@ -236,6 +236,7 @@ export class CreateGiftCode {
generateType: GIFT_GENERATE_TYPE; // 生成类型 generateType: GIFT_GENERATE_TYPE; // 生成类型
channel: string[] = ['all']; channel: string[] = ['all'];
code: string = ''; code: string = '';
type: number = 0; // 类型
constructor(obj: any) { constructor(obj: any) {
this.name = obj.name; this.name = obj.name;
@@ -247,6 +248,7 @@ export class CreateGiftCode {
this.generateType = obj.generateType; this.generateType = obj.generateType;
this.channel = obj.channel; this.channel = obj.channel;
this.code = obj.code; this.code = obj.code;
this.type = obj.type;
} }
checkParams() { checkParams() {
@@ -255,6 +257,7 @@ export class CreateGiftCode {
for(let { id, count } of this.goods) { for(let { id, count } of this.goods) {
if(!isNumber(id) || !isNumber(count)) return false; if(!isNumber(id) || !isNumber(count)) return false;
} }
if(this.type != 0 && this.type != 1 && this.type != 2) return false;
if(!isTimestamp(this.beginTime) || !isTimestamp(this.endTime)) return false; if(!isTimestamp(this.beginTime) || !isTimestamp(this.endTime)) return false;
if(!isNumber(this.codeLen) || this.codeLen <= 0) return false; if(!isNumber(this.codeLen) || this.codeLen <= 0) return false;