✨ feat(gvg): 概览
This commit is contained in:
@@ -11,7 +11,6 @@ class Player {
|
||||
teamCnt: number;
|
||||
}
|
||||
|
||||
|
||||
@index({ configId: 1, cityId: 1, groupId: 1, serverType: 1 })
|
||||
// GVGCity 类,继承自 BaseModel
|
||||
export default class GVGCity extends BaseModel {
|
||||
@@ -77,12 +76,16 @@ export default class GVGCity extends BaseModel {
|
||||
|
||||
// 占领城池
|
||||
public static async guardCity(configId: number, groupId: number, serverType: number, cityId: number, league: LeagueRankInfo) {
|
||||
console.log('##### guardCity', configId, groupId, serverType, cityId)
|
||||
const city: GVGCityType = await GVGCityModel.findOneAndUpdate({ configId: configId + 1, cityId, groupId, serverType }, { $set: {
|
||||
hasGuard: true, guardLeague: league.code, guardLeagueName: league.name, guardLeagueIcon: league.icon
|
||||
} }, { upsert: true, new: true }).lean();
|
||||
return city;
|
||||
}
|
||||
|
||||
public static async findByConfig(configId: number, groupId: number, serverType: number) {
|
||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, groupId, serverType, hasGuard: true }).lean();
|
||||
return cities
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user