✨ feat(gvgBattle): getCity返回正确的结构
This commit is contained in:
@@ -9,6 +9,7 @@ import { DicGVGAreaPoint } from "../pubUtils/dictionary/DicGVGAreaPoint";
|
||||
|
||||
@index({ roleId: 1, teamId: 1 })
|
||||
@index({ teamCode: 1 })
|
||||
@index({ cityId: 1, leagueId: 1 })
|
||||
export default class GVGTeam extends BaseModel {
|
||||
|
||||
@prop({ required: true })
|
||||
@@ -106,11 +107,21 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 查找角色队伍数
|
||||
public static async getTeamCnt(roleId: string) {
|
||||
public static async getTeamCntByRole(roleId: string) {
|
||||
const teams: GVGTeamType[] = await GVGTeamModel.find({ roleId }).select('teamCode').lean();
|
||||
return teams.length;
|
||||
}
|
||||
|
||||
// 通过城池ID获取队伍数
|
||||
public static async getTeamCntByCity(cityId: number, leagueCode?: string) {
|
||||
const query = { cityId };
|
||||
if (leagueCode) {
|
||||
query['leagueCode'] = leagueCode;
|
||||
}
|
||||
const teams: GVGTeamType[] = await GVGTeamModel.find(query).select('').lean();
|
||||
return teams.length;
|
||||
}
|
||||
|
||||
// 玩家切换城池更新队伍信息
|
||||
public static async enterCity(roleId: string, cityId: number, areaId: number, groupId: number, serverType: number) {
|
||||
const res = await GVGTeamModel.updateMany({ roleId }, { cityId, areaId, pointId: 0, groupId, serverType }).lean();
|
||||
|
||||
Reference in New Issue
Block a user