红点:修改推送方式

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,7 +5,7 @@ import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
import { RoleModel } from '../../../db/Role';
import { calculateSumCE, genCode } from '../../../pubUtils/util';
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies } from '../../../services/expeditionService';
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies, getExpeditionStatus } from '../../../services/expeditionService';
import { EXPEDITION_CONST, EXPEDITION_WAR_RECORD_STATUS, LINEUP_NUM, TASK_TYPE } from '../../../consts';
import { WarReward } from '../../../services/warRewardService';
import { addItems } from '../../../services/rewardService';
@@ -32,41 +32,9 @@ export class ExpeditionBattleHandler {
let roleId = session.get('roleId');
let roleName = session.get('roleName');
// 获取远征关卡状态
let expeditionRecord = await ExpeditionRecordModel.getCurRecord(roleId);
if (!expeditionRecord) { // 首次新建一条记录
// 我方战力
let myCe = await calculateSumCE(roleId, 1, { num: LINEUP_NUM });
expeditionRecord = await ExpeditionRecordModel.createRecord({
roleId, roleName, heroes: [], myCe
});
await findOrCreateEnemies(roleId, myCe, expeditionRecord.expeditionCode, 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
}
let res = await getExpeditionStatus(roleId, roleName);
// 每一关的挑战状态
let { expeditionCode, heroes } = expeditionRecord;
let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCode(expeditionCode);
let curLv = 0;
if (expeditionWarRecord.length > 0) {
curLv = expeditionWarRecord[expeditionWarRecord.length - 1].expeditionId;
}
// 重置次数
let role = await RoleModel.findByRoleId(roleId);
let curTime = new Date();
let { resetCnt } = await getResetRemainCnt(curTime, roleId, role);
// 点数,和宝箱领取状态
let pointRewards = await getPointRewardStatus(roleId, role);
return resResult(STATUS.SUCCESS, {
expeditionCode,
curLv,
expeditionWarRecord,
pointRewards,
heroes: heroes.map(cur => { return { "dataId": cur.seqId, "hp": cur.hp, "ap": cur.ap } }),
resetCnt
});
return resResult(STATUS.SUCCESS, res);
}
/**