满足条件开启功能推送,详细功能校验暂缺
This commit is contained in:
@@ -3,8 +3,11 @@ import { HeroModel } from '../db/Hero';
|
||||
import Role, { RoleModel } from '../db/Role'
|
||||
import { getLvByExp, getExpByLv } from '../pubUtils/gamedata';
|
||||
import { redisUserInfoUpdate } from './redisService';
|
||||
import { switchOnFunc } from './funcSwitchService';
|
||||
import { FUNC_OPT_TYPE } from '../consts/consts';
|
||||
import { Application, BackendSession } from 'pinus';
|
||||
|
||||
export async function roleLevelup(roleId: string, kingExp: number) {
|
||||
export async function roleLevelup(roleId: string, kingExp: number, app: Application, session: BackendSession) {
|
||||
let role = await RoleModel.findByRoleId(roleId);
|
||||
let {lv = 1, exp = 0} = role;
|
||||
let newExp = exp + kingExp;
|
||||
@@ -15,8 +18,9 @@ export async function roleLevelup(roleId: string, kingExp: number) {
|
||||
newExp = curExpObj.sum;
|
||||
}
|
||||
|
||||
await RoleModel.levelup(roleId, newLv, newExp);
|
||||
role = await RoleModel.levelup(roleId, newLv, newExp);
|
||||
if(newLv > lv) { // 升级
|
||||
await switchOnFunc(roleId, FUNC_OPT_TYPE.LEVEL_UP, newLv, app, session);
|
||||
await redisUserInfoUpdate(roleId, [{field: 'lv', value: newLv}])
|
||||
}
|
||||
let actordata = [];
|
||||
|
||||
Reference in New Issue
Block a user