后台:礼包码区分渠道

This commit is contained in:
luying
2022-04-09 15:20:04 +08:00
parent a23759335e
commit 6b13034c62
9 changed files with 24 additions and 15 deletions
+1
View File
@@ -414,6 +414,7 @@ export const STATUS = {
GIFT_CODE_NOT_START: { code: 31203, simStr: '礼包码未生效' },
GIFT_CODE_HAS_EXPIRED: { code: 31204, simStr: '礼包码已失效' },
GIFT_CODE_NOT_FOUND: { code: 31205, simStr: '未找到该礼包码' },
GIFT_CODE_CHANNEL_ERR: { code: 31206, simStr: '礼包码在您的渠道不生效' },
// 邮件相关 31301-31400
MAIL_HAS_RECEIVE: { code: 31301, simStr: '邮件已领取'},
EQUIP_IS_OVER: { code: 31302, simStr: '装备已超过上限,无法领取' },
+3
View File
@@ -43,6 +43,9 @@ export default class GiftCode extends BaseModel {
@prop({ required: true, default: 0, enum: GIFT_GENERATE_TYPE })
generateType: GIFT_GENERATE_TYPE; // 生成类型
@prop({ required: true, default: ['all'], type: String })
channel: string[]; // 可使用渠道
@prop({ required: true, default: 0 })
generateCnt: number; // 生成条数,giftCodeDetail的数量
+1 -1
View File
@@ -21,7 +21,7 @@ class RoleRecord {
}
/**
* 举报记录
* 领取记录
**/
@modelOptions({ schemaOptions: { id: false } })
@index({ code: 1 })
+2 -2
View File
@@ -42,7 +42,7 @@ export default class User extends BaseModel {
channelId: string; // 渠道类型
@prop({ required: true, _id: false })
channelInfo: LoginValidateData37|{}; // 渠道数据
channelInfo: LoginValidateData37; // 渠道数据
@prop({ required: true, set: (val: string) => aesEncryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV), get: (val: string) => val?aesDecryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV):'' })
tel: string; // 账号
@@ -236,7 +236,7 @@ export default class User extends BaseModel {
}
public static async findUserByToken(token: string) {
const user: UserType = await UserModel.findOne({ token }).select('uid token serverType auth tel userCode pkgName ip').lean({ getters: true });
const user: UserType = await UserModel.findOne({ token }).select('uid token serverType auth tel userCode pkgName ip channelInfo').lean({ getters: true });
return user;
}
+5 -1
View File
@@ -47,7 +47,8 @@ export class UpdateMailParams {
}
checkParams() {
if(!this.title || !this.content || !this.sendName || !this.reason) return false;
if(!this.title || !this.content || !this.sendName) return false;
if(this.reason && !isString(this.reason)) return false;
if(this.timeType == MAIL_TIME_TYPE.IMMEDIATE) {
if(!this.expire) return false;
} else if (this.timeType == MAIL_TIME_TYPE.DELAY) {
@@ -191,6 +192,7 @@ export class CreateGiftCode {
codeLen: number; // 礼包码位数
remark: string = ''; // 备注
generateType: GIFT_GENERATE_TYPE; // 生成类型
channel: string[] = ['all'];
code: string = '';
constructor(obj: any) {
@@ -201,6 +203,7 @@ export class CreateGiftCode {
this.codeLen = obj.codeLen;
this.remark = obj.remark;
this.generateType = obj.generateType;
this.channel = obj.channel;
this.code = obj.code;
}
@@ -217,6 +220,7 @@ export class CreateGiftCode {
return false
}
if(this.code != undefined && !isString(this.code)) return false
if(!isArray(this.channel)) return false;
return true;
}
}
+2 -2
View File
@@ -52,7 +52,7 @@ export interface LoginValidataReturn37 {
data: LoginValidateData37;
}
export type ChannelInfo = LoginValidataReturn37|{};
export type ChannelInfo = LoginValidateData37;
export class PayCallback37Data {
appid: string; // 平台id
@@ -125,7 +125,7 @@ export class Chat37Params {
}
setByMyRole(role: RoleType, user: UserType) {
let channelInfo = <LoginValidateData37>user.channelInfo;
let channelInfo = <ChannelInfo>user.channelInfo;
this.username = channelInfo.uid;
this.actor = role.roleName;
this.actor_id = role.roleId;