✨ feat(gvg): 添加组建期邮件、添加自动解散定时任务

This commit is contained in:
luying
2023-02-17 10:58:46 +08:00
parent e7a62c4e3e
commit 3fc6b91a51
8 changed files with 53 additions and 19 deletions
+8 -1
View File
@@ -11,6 +11,7 @@ import { getRandSingleEelm } from "../../pubUtils/util";
import { GVG } from "../../pubUtils/dicParam";
import { ServerlistModel } from "../../db/Serverlist";
import { GuildModel, GuildType } from "../../db/Guild";
import { checkHasCities } from "./gvgBattleService";
// 定时器相关
export async function createNewGVGConfig() {
@@ -24,7 +25,13 @@ export async function createNewGVGConfig() {
} catch(e) {
console.log('remote未初始完');
}
// TODO 每周自动解散一些联军
// 每周自动解散一些联军
let autoLeagues = await GVGLeagueModel.findAutoCreateLeague();
let needDissmissLeagueId: string[] = [];
for(let league of autoLeagues) {
if(!await checkHasCities(league)) needDissmissLeagueId.push(league._id);
}
await GVGLeagueModel.dismissByIds(needDissmissLeagueId);
return config;
}