✨ feat(礼包码): 礼包码类型区分
This commit is contained in:
@@ -975,6 +975,11 @@ export enum GIFT_GENERATE_TYPE {
|
||||
ONE_TO_MANY = 2, // 通码,一条码能被多人使用,每个人只能用一次
|
||||
}
|
||||
|
||||
export enum GIFT_TYPE {
|
||||
GAME = 1, // 游戏内码
|
||||
WEB = 2, // 外链发送
|
||||
}
|
||||
|
||||
export enum ITEM_CHANGE_REASON {
|
||||
DEBUG = 0, // debug接口、后台
|
||||
RENAME = 1, // 重命名
|
||||
|
||||
@@ -599,6 +599,7 @@ export const STATUS = {
|
||||
GIFT_CODE_HAS_EXPIRED: { code: 31204, simStr: '礼包码已失效' },
|
||||
GIFT_CODE_NOT_FOUND: { code: 31205, simStr: '未找到该礼包码' },
|
||||
GIFT_CODE_CHANNEL_ERR: { code: 31206, simStr: '礼包码在您的渠道不生效' },
|
||||
GIFT_TYPE_ERR: { code: 31207, simStr: '该礼包码不可在此界面使用' },
|
||||
// 邮件相关 31301-31400
|
||||
MAIL_HAS_RECEIVE: { code: 31301, simStr: '邮件已领取'},
|
||||
EQUIP_IS_OVER: { code: 31302, simStr: '装备已超过上限,无法领取' },
|
||||
@@ -816,4 +817,5 @@ export const SDK_37_ACTIVITY_CODE = {
|
||||
TIME_IS_EXPIRED: { code: 20008, simStr: '时间戳已过期' },
|
||||
SERVER_NOT_FOUND: { code: 20009, simStr: '服务器未找到' },
|
||||
GIFT_CODE_CANNOT_USE: { code: 20010, simStr: '该礼包码不可使用' },
|
||||
GIFT_TYPE_ERR: { code: 20011, simStr: '该礼包码类型错误' },
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export default class GiftCode extends BaseModel {
|
||||
usedNum: number; // 使用次数
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
type: number; // 0-游戏内领取 1-公众号口令活动领取 2-邮件领取
|
||||
type: number; // 0-游戏内领取 1-邮件领取
|
||||
|
||||
@prop({ required: true, default: true })
|
||||
isEnable: boolean; // 是否可以使用
|
||||
@@ -76,7 +76,6 @@ export default class GiftCode extends BaseModel {
|
||||
}
|
||||
|
||||
public static async updateData(id: number, values: GiftCodeParam, uid = 1) {
|
||||
|
||||
let rec: GiftCodeType = await GiftCodeModel.findOneAndUpdate({ id }, { $set: {...values, updatedBy: uid} },
|
||||
{ new: true }).lean(true);
|
||||
return rec;
|
||||
|
||||
@@ -275,6 +275,7 @@ export class UpdateGiftCode {
|
||||
endTime: number; // 结束时间
|
||||
codeLen: number; // 礼包码位数
|
||||
remark: string = ''; // 备注
|
||||
type: number; // 类型 0-游戏内 1-外链调用
|
||||
|
||||
constructor(id: number, obj: any) {
|
||||
this.id = id;
|
||||
@@ -284,6 +285,7 @@ export class UpdateGiftCode {
|
||||
this.endTime = obj.endTime;
|
||||
this.codeLen = obj.codeLen;
|
||||
this.remark = obj.remark;
|
||||
this.type = obj.type;
|
||||
}
|
||||
|
||||
checkParams() {
|
||||
@@ -295,6 +297,7 @@ export class UpdateGiftCode {
|
||||
}
|
||||
if(!isTimestamp(this.beginTime) || !isTimestamp(this.endTime)) return false;
|
||||
if(!isNumber(this.codeLen) || this.codeLen <= 0) return false;
|
||||
if(this.type != 0 && this.type != 1) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user