🐞 fix(gvg): 添加确认队伍
This commit is contained in:
@@ -166,16 +166,17 @@ export function calBattleScoreByCe(isSuccess: boolean, lineupCe: number) {
|
||||
return isSuccess? winScore: 0;
|
||||
}
|
||||
|
||||
export async function refreshTeams(configId: number, groupKey: string, roleId: string, myLeague: GVGLeagueType) {
|
||||
export async function refreshTeams(configId: number, groupKey: string, roleId: string, myLeague: GVGLeagueType, hasConfirm: boolean) {
|
||||
let oldTeams = await GVGTeamModel.findByRole(roleId, '-_id');
|
||||
let teams: GVGTeamType[] = [];
|
||||
for(let team of oldTeams) {
|
||||
if(team.configId != configId) {
|
||||
if(team.configId != configId || (hasConfirm && team.confirmConfigId != configId)) {
|
||||
let { teamCode, maxDurability, lineup } = team;
|
||||
let { lv, roleName, guildCode } = await RoleModel.findByRoleId(roleId, 'lv roleName guildCode');
|
||||
let heroes = await HeroModel.findByHidRange(lineup.map(hero => hero.actorId), roleId);
|
||||
let { newLineup, newLineupCe } = await generNewLineup(roleId, heroes, lineup.map(({ actorId, dataId, outIndex }) => ({ actorId, dataId, order: outIndex })));
|
||||
let newTeam = await GVGTeamModel.refreshByConfig(teamCode, { configId, lv, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey, lineup: newLineup, lineupCe: newLineupCe });
|
||||
let addUpdate = hasConfirm? { confirmConfigId: configId }: {};
|
||||
let newTeam = await GVGTeamModel.refreshByConfig(teamCode, { configId, lv, durability: maxDurability, cityId: 0, areaId: 0, pointId: 0, roleName, guildCode, leagueCode: myLeague.leagueCode, leagueName: myLeague.name, groupKey, lineup: newLineup, lineupCe: newLineupCe, ...addUpdate });
|
||||
teams.push(newTeam);
|
||||
} else {
|
||||
teams.push(team);
|
||||
|
||||
Reference in New Issue
Block a user