红点:修改推送方式

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

@@ -2,10 +2,30 @@
* 每日本相关
*/
import { resResult, shouldRefresh } from '../pubUtils/util';
import { resResult, shouldRefresh, calculateNum } from '../pubUtils/util';
import { STATUS } from '../consts/statusCode';
import { RoleModel } from '../db/Role';
import { DUNGEON_CONST } from '../consts';
import { RoleModel, RoleType } from '../db/Role';
import { DUNGEON_CONST, GOLD_COST_RATIO } from '../consts';
/**
* 获取秘境本数据
* @param role
*/
export async function getDungeonData(role: RoleType) {
let { dungeonCnt = 0, dungeonBuyCnt = 0, dungeonRefTime, dungeonHeroes=[] } = role;
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 {
nextCostGold,
dungeonHeroes,
battleCount: DUNGEON_CONST.MAX_CNT + dungeonBuyCnt - dungeonCnt,
buyCount: DUNGEON_CONST.MAX_BUY_CNT - dungeonBuyCnt
}
}
// 检查秘境本次数checkBattle使用
export async function checkDungeonNum(roleId: string, inc: number) {