满足条件开启功能推送,详细功能校验暂缺

This commit is contained in:
luying
2020-11-26 19:29:28 +08:00
parent f2e288f25d
commit 1f05043b4b
14 changed files with 158 additions and 44 deletions

View File

@@ -292,3 +292,12 @@ export const REDIS_KEY = {
USER_INFO: "userInfo", // 玩家缓存信息
TOWER_RANK: "towerRank" // 天梯排行榜
}
export const FUNC_OPT_TYPE = {
LEVEL_UP: 1,
BATTLE_END: 2
}
export const FUNCS_ID = {
EVENT: 1
}

View File

@@ -121,5 +121,6 @@ export const STATUS = {
GM_ROLE_NOT_FOUND: { code: 60010, simStr: '未找到该玩家' },
GM_HERO_NOT_FOUND: { code: 60011, simStr: '未找到武将' },
GM_PVP_DEFENSE_NOT_FOUND: { code: 60012, simStr: '该玩家未保存防守阵' },
GM_PVP_DEFENSE_HERO_NOT_FOUND: { code: 60013, simStr: '该守阵没有该武将' }
GM_PVP_DEFENSE_HERO_NOT_FOUND: { code: 60013, simStr: '该守阵没有该武将' },
GM_JSON_FORMAT_ERR: { code: 60005, simStr: 'json格式错误' }
}

View File

@@ -119,6 +119,9 @@ export default class Role extends BaseModel {
@prop({ required: true })
loginTime: Date; // 更新 / 登录时间
@prop({ required: true, type: Number, default: [] })
funcs: Array<number>; // 开启了的功能
// 天梯相关
@prop({ required: true, default: 1 })
towerLv: number; // 天梯当前层数
@@ -366,6 +369,12 @@ export default class Role extends BaseModel {
}
}
}
// 保存开启功能
public static async pushFuncs(roleId: string, funcs: Array<number>, lean = true) {
const recs = await RoleModel.findOneAndUpdate({roleId}, {$push: {funcs: {$each: funcs}}}, {new: true}).lean(lean);
return recs
}
}
export const RoleModel = getModelForClass(Role);

View File

@@ -0,0 +1,9 @@
[
{
"id": 1,
"desc": "奇遇",
"conditionType": 1,
"param": 1,
"script": "&"
}
]