添加保存R剧本接口

This commit is contained in:
luying
2020-10-22 11:05:49 +08:00
parent 3d031088b7
commit 318d45e50e
8 changed files with 202 additions and 37 deletions
+1 -21
View File
@@ -5,7 +5,7 @@ import { HANG_UP_CONSTS } from './../consts/consts';
import { BattleRecordModel } from './../db/BattleRecord';
import { TowerRecordModel } from './../db/TowerRecord';
import { RoleModel } from './../db/Role';
import { getHeroInfoById, getJobInfoById, getTowerDataByLv, getLvByExp, getExpByLv } from "../pubUtils/gamedata"
import { getHeroInfoById, getJobInfoById, getTowerDataByLv } from "../pubUtils/gamedata"
import { decodeArrayStr, shouldRefresh, resResult } from '../pubUtils/util';
import { handleFixedReward } from './rewardService';
import { STATUS } from '../consts/statusCode';
@@ -183,23 +183,3 @@ export async function checkTaskConditions(roleId: string, heroes: Array<number>,
return res;
}
export async function roleLevelup(roleId: string, kingExp: number) {
let role = await RoleModel.findByRoleId(roleId);
let {lv = 1, exp = 0} = role;
exp += kingExp;
let newLv = getLvByExp(exp);
await RoleModel.levelup(roleId, newLv, exp);
let actordata = [];
for(let i = lv; i <= newLv; i++) {
let {sum, cur} = getExpByLv(i);
let getExp = sum > exp? sum - exp: 0;
actordata.push({
lv : i,
exp : cur - getExp,
getExp : getExp,
mostExp : cur
})
}
return {actordata, lv, exp, kingExp};
}