🐞 fix(gvg): 添加退出游戏后撤退据点

This commit is contained in:
luying
2023-02-28 11:15:41 +08:00
parent ad122098a5
commit b4c81f6b79
2 changed files with 5 additions and 0 deletions

View File

@@ -190,6 +190,7 @@ export async function leaveCity(isForce: boolean, roleId: string, serverId: numb
await GVGTeamModel.leaveCity(roleId); await GVGTeamModel.leaveCity(roleId);
await GVGCityModel.decreasePlayer(configId, groupKey, roleId); await GVGCityModel.decreasePlayer(configId, groupKey, roleId);
await GVGUserDataModel.changeCity(configId, myLeague.leagueCode, roleId, 0); await GVGUserDataModel.changeCity(configId, myLeague.leagueCode, roleId, 0);
await GVGCityAreaPointModel.playerLeave(configId, groupKey, roleId);
// 处理内存数据 // 处理内存数据
let teamObj = getGVGBattleData(groupKey); let teamObj = getGVGBattleData(groupKey);
teamObj.leaveCity(roleId); teamObj.leaveCity(roleId);

View File

@@ -50,6 +50,10 @@ export default class GVGCityAreaPoint extends BaseModel {
return result; return result;
} }
public static async playerLeave(configId: number, groupKey: string, roleId: string) {
await GVGCityAreaPointModel.updateMany({ configId, groupKey, roleId }, { $set: { teamCode: '', roleId: '', roleName: '', leagueCode: '', leagueName: '' }});
}
public static async findByConfig(configId: number, groupKey: string) { public static async findByConfig(configId: number, groupKey: string) {
let result: GVGCityAreaPointType[] = await GVGCityAreaPointModel.find({ configId, groupKey }).lean(); let result: GVGCityAreaPointType[] = await GVGCityAreaPointModel.find({ configId, groupKey }).lean();
return result return result