🐞 fix(gvg): 积分点交换问题

This commit is contained in:
luying
2023-03-08 12:32:09 +08:00
parent 96ea790bd1
commit 52debbd8b3
2 changed files with 7 additions and 8 deletions

View File

@@ -474,6 +474,7 @@ export class GVGBattleHandler {
if(!record) return resResult(STATUS.GVG_BATTLEREC_NOT_FOUND);
if(record.battleEndTime > 0) return resResult(STATUS.GVG_BATTLEREC_HAS_SUMMIT);
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(record.attackTeam.teamCode, record.defenseTeam.teamCode);
let attackOriginId = attackTeam.pointId;
if(defenseTeam.lockTeamCode != attackTeam.teamCode) return resResult(STATUS.GVG_LOCK_TIME_OUT)
let groupKey = await getGroupKey(serverId);
@@ -498,10 +499,8 @@ export class GVGBattleHandler {
if(defenseTeam.curTeamBreak) {
let attackScore = calBattleScoreByCe(isSuccess, defenseTeam.lineupCe);
let attackCurTeamBreak = attackTeam.curTeamBreak;
let originPointId = attackTeam.originPointId;
attackTeam = await GVGTeamModel.addScore(attackTeam.teamCode, attackScore, 0);
attackTeam.curTeamBreak = attackCurTeamBreak;
attackTeam.originPointId = originPointId;
await redisAddBattleScore(attackTeam, attackScore);
}
@@ -510,7 +509,7 @@ export class GVGBattleHandler {
teamObj.battleEnd([attackTeam, defenseTeam]);
// 更新rec
let rec = await GVGBattleRecModel.battleEnd(battleCode, isSuccess, attackTeam, defenseTeam);
await battleEndSendMessage(groupKey, cityId, defenseTeam, attackTeam, GVG_ATTACK_TYPE.PLAYER);
await battleEndSendMessage(groupKey, cityId, defenseTeam, {...attackTeam, originPointId: attackOriginId}, GVG_ATTACK_TYPE.PLAYER);
addBattleEndRec(rec);
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
@@ -533,6 +532,7 @@ export class GVGBattleHandler {
let groupKey = await getGroupKey(serverId);
let { attackTeam, defenseTeam } = await GVGTeamModel.findBattleTeams(teamCode, oppoTeamCode);
let attackOriginId = attackTeam.pointId;
let checkStatus = checkGVGBattleStart(roleId, attackTeam, defenseTeam);
if(checkStatus.code != 0) return resResult(checkStatus);
@@ -565,7 +565,7 @@ export class GVGBattleHandler {
let teamObj = getGVGBattleData(groupKey);
teamObj.battleEnd([attackTeam, defenseTeam]);
await battleEndSendMessage(groupKey, cityId, defenseTeam, attackTeam, GVG_ATTACK_TYPE.KNIFE);
await battleEndSendMessage(groupKey, cityId, defenseTeam, {...attackTeam, originPointId: attackOriginId}, GVG_ATTACK_TYPE.KNIFE);
return resResult(STATUS.SUCCESS, { curTeam: new MyTeamInfo(attackTeam), oppTeam: new MyTeamInfo(defenseTeam) });
}