红点:修改推送方式

This commit is contained in:
luying
2021-05-31 13:29:58 +08:00
parent 44d9e80640
commit a8eebc200c
38 changed files with 805 additions and 605 deletions

View File

@@ -5,6 +5,7 @@ import { resResult, calculateNum, shouldRefresh } from '../../../pubUtils/util';
import { RoleModel } from '../../../db/Role';
import { handleCost } from '../../../services/rewardService';
import { getGoldObject } from '../../../pubUtils/itemUtils';
import { getDungeonData } from '../../../services/dungeonService';
export default function(app: Application) {
return new DungeonBattleHandler(app);
@@ -17,19 +18,9 @@ export class DungeonBattleHandler {
// 获取关卡列表
async getData(msg: { }, session: BackendSession) {
let roleId = session.get('roleId');
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, dungeonHeroes=[] } = await RoleModel.findByRoleId(roleId);
let curTime = new Date();
if(shouldRefresh(dungeonRefTime, curTime)) {
dungeonCnt = 0; dungeonBuyCnt = 0;
}
let nextCostGold = calculateNum(GOLD_COST_RATIO.DUNGRON_BUY_NUM, {num: dungeonBuyCnt + 1 }, 50);
return resResult(STATUS.SUCCESS, {
nextCostGold,
dungeonHeroes,
battleCount: DUNGEON_CONST.MAX_CNT + dungeonBuyCnt - dungeonCnt,
buyCount: DUNGEON_CONST.MAX_BUY_CNT - dungeonBuyCnt
});
let role = await RoleModel.findByRoleId(roleId);
let res = await getDungeonData(role);
return resResult(STATUS.SUCCESS, res);
}
// 购买每日次数