✨ feat(gvg): 组建期

This commit is contained in:
luying
2023-02-17 10:58:03 +08:00
parent 94c69089ac
commit 03fa74f3d1
50 changed files with 10354 additions and 38 deletions
+29
View File
@@ -23,6 +23,8 @@ import { ChannelInfoModel } from '@db/ChannelInfo';
import { PVPConfigModel } from '@db/PvpConfig';
import { HiddenDataByIdModel } from '@db/HiddenDataById';
import { isNumber } from 'util';
import { GVGServerGroupModel } from '@db/GVGServerGroup';
import { GVGConfigModel } from '@db/GVGConfig';
/**
* Test Service
@@ -347,4 +349,31 @@ export default class Game extends Service {
ids: existIds
});
}
public async getGVGServerGroup() {
const { ctx } = this;
const serverlists = await ServerlistModel.findByEnv(this.app.config.realEnv);
const currentTypes = await GVGServerGroupModel.findByTime(nowSeconds());
const nextTypes = await GVGServerGroupModel.findByTime(nowSeconds() + 7 * 86400);
const servers = serverlists.map(server => {
let current = currentTypes.find(obj => obj.serverId == server.id);
let next = nextTypes.find(obj => obj.serverId == server.id);
let dic = gameData.serverNames.get(server.id);
return { id: server.id, serverId: server.serverId, name: server.name, current: current?.groupId|| dic.groupId, next: next?.groupId|| current?.groupId || dic.groupId, env: this.app.config.realEnv }
});
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list: servers
});
}
public async getGVGConfig() {
const { ctx } = this;
const gvgconfig = await GVGConfigModel.findConfig();
return ctx.service.utils.resResult(STATUS.SUCCESS, {
list: gvgconfig?[{...gvgconfig, env: this.app.config.realEnv }]: []
});
}
}