任务:埋点48/71

This commit is contained in:
luying
2021-04-19 13:17:17 +08:00
parent 9f4f346447
commit 4bd4513ae6
11 changed files with 186 additions and 37 deletions
@@ -7,13 +7,14 @@ import { ExpeditionPointModel } from '../../../db/ExpeditionPoint';
import { RoleModel } from '../../../db/Role';
import { calculateSumCE, genCode } from '../../../pubUtils/util';
import { getPointRewardStatus, getResetRemainCnt, findOrCreateEnemies } from '../../../services/expeditionService';
import { EXPEDITION_CONST, EXPEDITION_WAR_RECORD_STATUS, LINEUP_NUM } from '../../../consts';
import { EXPEDITION_CONST, EXPEDITION_WAR_RECORD_STATUS, LINEUP_NUM, TASK_TYPE } from '../../../consts';
import { WarReward } from '../../../services/warRewardService';
import { handleFixedReward } from '../../../services/rewardService';
import { getAp, setAp } from '../../../services/actionPointService';
import { STATUS } from '../../../consts/statusCode';
import { resResult } from '../../../pubUtils/util';
import { checkBattleHeroes, roleLevelup } from '../../../services/normalBattleService';
import { checkTaskWithWar } from '../../../services/taskService';
export default function(app: Application) {
return new ExpeditionBattleHandler(app);
@@ -146,7 +147,7 @@ export class ExpeditionBattleHandler {
* 记录我军数据,生成战斗唯一表示,记录状态
*/
async checkBattle(msg: { expeditionCode: string, expeditionId: number, battleId: number, heroes: Array<number> }, session: BackendSession) {
const { expeditionCode, expeditionId, battleId, heroes } = msg;
const { expeditionCode, expeditionId, battleId, heroes: seqIds } = msg;
let roleId = session.get('roleId');
let roleName = session.get('roleName');
let warInfo = getWarById(battleId);
@@ -167,8 +168,8 @@ export class ExpeditionBattleHandler {
if(!preBattle) return resResult(STATUS.BATTLE_NEED_PREVIOUS_GK);
}
let checkHeroes = await checkBattleHeroes(roleId, heroes);
if(!checkHeroes) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
let { isOK, heroes } = await checkBattleHeroes(roleId, seqIds);
if(!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
let expeditionWarRecord = await ExpeditionWarRecordModel.getRecordByCodeAndId(expeditionCode, expeditionId);
if(!expeditionWarRecord ) {
@@ -185,7 +186,7 @@ export class ExpeditionBattleHandler {
status: 0,
warName: warInfo.gk_name,
warType: warInfo.warType,
record: { heroes }
record: { heroes, seqIds }
}
}, true);
@@ -226,9 +227,9 @@ export class ExpeditionBattleHandler {
}
let flag = 1; // 对比hero信息
let { record: { heroes: dbHeroes } } = BattleRecord;
let { record: { heroes: dbHeroes, seqIds: dbSeqIds } } = BattleRecord;
for(let {dataId} of heroes) {
if(dbHeroes.indexOf(dataId) == -1) flag = 0;
if(dbSeqIds.indexOf(dataId) == -1) flag = 0;
}
if(!flag) {
return resResult(STATUS.BATTLE_INFO_VALIDATE_ERR);
@@ -268,6 +269,7 @@ export class ExpeditionBattleHandler {
// 更新下一关状态
await ExpeditionWarRecordModel.updateStatus(expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.WAITING);
}
await checkTaskWithWar(roleId, sid, TASK_TYPE.BATTLE_WITH_HERO, battleId, dbHeroes, 1, star);
return resResult(STATUS.SUCCESS, {
expeditionCode, expeditionId,