修复决金箭bug

This commit is contained in:
kron
2025-07-08 13:23:29 +08:00
parent 06d8244e83
commit 4f56bdb8f0
4 changed files with 16 additions and 7 deletions

View File

@@ -165,12 +165,15 @@ export const getGameAPI = async (battleId) => {
mode: battleStats.mode,
gameMode: battleStats.gameMode,
};
if (battleStats.mode === 1) {
if (battleStats && battleStats.mode === 1) {
data.winner = battleStats.winner;
data.roundsData = {};
data.redPlayers = {};
data.bluePlayers = {};
data.goldenRound = goldenRoundRecords && goldenRoundRecords.length ? goldenRoundRecords[0] : null;
data.goldenRound =
goldenRoundRecords && goldenRoundRecords.length
? goldenRoundRecords[0]
: null;
playerStats.forEach((item) => {
const { playerBattleStats = {}, roundRecords = [] } = item;
if (playerBattleStats.team === 0) {
@@ -187,7 +190,7 @@ export const getGameAPI = async (battleId) => {
});
});
}
if (battleStats.mode === 2) {
if (battleStats && battleStats.mode === 2) {
data.players = [];
playerStats.forEach((item) => {
data.players.push({