后台添加设定玩家等级

This commit is contained in:
luying
2020-11-27 10:58:53 +08:00
parent 4194b1d881
commit 78a1b805f0
3 changed files with 19 additions and 1 deletions
+13
View File
@@ -315,6 +315,19 @@ export default class GMUsers extends Service {
return ctx.service.utils.resResult(STATUS.SUCCESS, { uids });
}
public async levelUp(uids: Array<string>, _lv: string) {
const {ctx} = this;
console.log('gm levelUp', uids, _lv);
let lv = parseInt(_lv);
if(isNaN(lv)) return ctx.service.utils.resResult(STATUS.WRONG_PARMS);
for(let roleId of uids) {
let exp = ctx.service.utils.getExpByLv(lv);
await RoleModel.levelup(roleId, lv, exp?exp.sum:0);
}
return ctx.service.utils.resResult(STATUS.SUCCESS, { uids });
}
public async getPvpDefense(roleId: string) {
const {ctx} = this;
let result = await PvpDefenseModel.findByRoleId(roleId);