fix bug 远征关卡最后一关获取失败

This commit is contained in:
luying
2020-11-20 16:49:55 +08:00
parent b304dee798
commit d9e1bc2bcb
3 changed files with 10 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
import { Application, BackendSession } from 'pinus';
import { getGamedata, getWarById } from '../../../pubUtils/gamedata';
import { getGamedata, getWarById, hasExpeditionById } from '../../../pubUtils/gamedata';
import { BattleRecordModel } from '../../../db/BattleRecord';
import { ExpeditionRecordModel } from '../../../db/ExpeditionRecord';
import { ExpeditionWarRecordModel } from '../../../db/ExpeditionWarRecord';
@@ -125,8 +125,11 @@ export class ExpeditionBattleHandler {
}
let { battleId, enemyFrom, enemies, battleStatus, ce: curCe } = curExpeditionWarRecord;
let nextCe = 0; // 下一关战力
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE);
if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce;
if(hasExpeditionById(expeditionId + 1)) {
let nextExpeditionWarRecord = await findOrCreateEnemies(roleId, myCe, expeditionCode, expeditionId + 1, EXPEDITION_WAR_RECORD_STATUS.HIDE);
if(nextExpeditionWarRecord) nextCe = nextExpeditionWarRecord.ce;
}
return resResult(STATUS.SUCCESS, {
expeditionCode, expeditionId, battleId,