✨ feat(gvg): 激战期数据补充、排行榜等
This commit is contained in:
+14
-2
@@ -63,8 +63,20 @@ export default class GVGCity extends BaseModel {
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async findGuardCityByLeague(configId: number, groupId: number, serverType: number, ) {
|
||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, groupId, serverType, hasGuard: true }).lean();
|
||||
public static async findGuardCityByLeague(configId: number, leagueCode: string, select = '') {
|
||||
const cities: GVGCityType[] = await GVGCityModel.find({ configId, guardLeague: leagueCode, hasGuard: true }).select(select).lean();
|
||||
return cities
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async checkLeagueHasGuard(configId: number, leagueCode: string) {
|
||||
return await GVGCityModel.exists({ configId, guardLeague: leagueCode, hasGuard: true });
|
||||
}
|
||||
|
||||
// 查询联军驻守情况
|
||||
public static async findGuardCity(configId: number, groupId: number, serverType: number, select = '') {
|
||||
let cities: GVGCityType[] = await GVGCityModel.find({ configId: configId + 1, groupId, serverType, hasGuard: true }).select(select).lean();
|
||||
if(cities.length == 0) cities = await GVGCityModel.find({ configId, groupId, serverType, hasGuard: true }).select(select).lean();
|
||||
return cities
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,10 @@ export default class GVGTeam extends BaseModel {
|
||||
defenseTime: number; // 防守保护时间
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
score: number; // 积分
|
||||
battleScore: number; // 积分
|
||||
|
||||
@prop({ required: true, default: 0 })
|
||||
settleScore: number; // 积分
|
||||
|
||||
@prop({ required: true, type: () => GVGHeroInfo, _id: false })
|
||||
lineup: GVGHeroInfo[];
|
||||
@@ -336,8 +339,8 @@ export default class GVGTeam extends BaseModel {
|
||||
}
|
||||
|
||||
// 加积分
|
||||
public static async addScore(teamCode: string, incScore: number) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { score: incScore } }, { new: true }).lean();
|
||||
public static async addScore(teamCode: string, battleScore: number, settleScore: number) {
|
||||
let team: GVGTeamType = await GVGTeamModel.findOneAndUpdate({ teamCode }, { $inc: { battleScore, settleScore } }, { new: true }).lean();
|
||||
return team;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user