pvp随机地图

This commit is contained in:
mamengke01
2021-01-07 12:25:19 +08:00
parent a339b8adcc
commit 94fc48a59a
17 changed files with 327 additions and 84 deletions

View File

@@ -15,6 +15,21 @@ export default class SystemConfig extends BaseModel {
const result: SystemConfigType = await SystemConfigModel.findOne({ id: 1 }).lean(lean);
return result;
}
public static async createSystemConfig(seasonEndTime: number, warId: number, lean = true) {
const result: SystemConfigType = await SystemConfigModel.findOneAndUpdate({ id: 1}, { seasonEndTime, warId }, { upsert: true, new: true }).lean(lean);
return result;
}
public static async updateSystemConfig(update: { seasonEndTime?: number, warId?: number, seasonNum?:number }, lean = true) {
const result: SystemConfigType = await SystemConfigModel.findOneAndUpdate({ id: 1}, update, { upsert: true, new: true }).lean(lean);
return result;
}
public static async updateSeason( seasonEndTime: number, lean = true) {
const result: SystemConfigType = await SystemConfigModel.findOneAndUpdate({ id: 1}, { $seasonEndTime: seasonEndTime, $inc: { seasonNum:1 } }, { upsert: true, new: true }).lean(lean);
return result;
}
}
export const SystemConfigModel = getModelForClass(SystemConfig);