🐞 fix(gvg): 修复攻打掉占领据点的队伍时的数据错误
This commit is contained in:
@@ -35,12 +35,12 @@ export default class GVGCityAreaPoint extends BaseModel {
|
||||
@prop({ required: true })
|
||||
teamCode: string; // 玩家的编队
|
||||
|
||||
public static async settlePoint(cityId: number, areaId: number, pointId: number, team: GVGTeamType) {
|
||||
public static async settlePoint(cityId: number, areaId: number, pointId: number, team: GVGTeamType, originTeam = '') {
|
||||
let { configId, groupKey, leagueCode, leagueName, roleId, roleName, teamCode } = team;
|
||||
await GVGCityAreaPointModel.updateMany({ configId, groupKey, teamCode }, { $set: { teamCode: '', roleId: '', roleName: '', leagueCode: '', leagueName: '' } });
|
||||
await GVGCityAreaPointModel.findOneAndUpdate({ configId, groupKey, pointId }, { $setOnInsert: { teamCode: '' }}, { upsert: true });
|
||||
let result: GVGCityAreaPointType = await GVGCityAreaPointModel.findOneAndUpdate(
|
||||
{ configId, groupKey, pointId, teamCode: '' },
|
||||
{ configId, groupKey, pointId, teamCode: originTeam },
|
||||
{ $set: { cityId, areaId, leagueCode, leagueName, roleId, roleName, teamCode } },
|
||||
{ new: true }).lean();
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user