pvp随机地图
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user