后台:设置军团练兵场关卡

This commit is contained in:
luying
2022-08-26 11:34:07 +08:00
parent faa05c72d6
commit 4989ff6846
4 changed files with 34 additions and 2 deletions
@@ -27,6 +27,7 @@ import { DicWar } from '../../../pubUtils/dictionary/DicWar';
import { SchoolModel } from '../../../db/School';
import { JewelModel } from '../../../db/Jewel';
import { RoleCeModel } from '../../../db/RoleCe';
import { setTrainLv } from '../../../services/gmService';
let timer: NodeJS.Timer;
export default function (app: Application) {
@@ -187,6 +188,11 @@ export class GmRoleHandler {
}
guild = await GuildModel.updateInfo(params.code, updateParams);
if(params.trainLv) {
await setTrainLv(params.code, params.trainLv);
}
return resResult(STATUS.SUCCESS);
}
async dismissGuild(msg: { code: string }, session: BackendSession) {
+19
View File
@@ -33,6 +33,10 @@ import { getPopUpShopData } from "./activity/popUpShopService";
import { TaskPassData } from "../domain/activityField/taskPassField";
import { ActivityGroupModel } from "../db/ActivityGroup";
import { redisClient } from "./redisService";
import { gameData } from "../pubUtils/data";
import { GuildModel } from "../db/Guild";
import { GuildTrainModel } from "../db/GuildTrain";
import { unlockTrain } from "./guildTrainService";
// —————————————— 跑马灯 —————————————— //
// 初始
@@ -364,4 +368,19 @@ export async function getSurvey(roleId: string, lv: number) {
let index = recs.findIndex(rec => rec.surveyId == survey.surveyId);
return index == -1
});
}
export async function setTrainLv(guildCode: string, trainLv: string) {
let [_lv, _id] = trainLv.split('-');
let lv = parseInt(_lv), id = parseInt(_id);
if(!isNaN(lv) && !isNaN(id)) {
let structure = gameData.trainBase.get(lv);
let trainIds = structure?.trainIds||[];
let trainId = trainIds[id - 1];
if(trainId) {
await GuildModel.updateInfo(guildCode, { trainId, trainLv: lv });
await GuildTrainModel.resetGuildTrain(guildCode);
await unlockTrain(guildCode, trainId);
}
}
}