✨ feat(gvg): 组建期
This commit is contained in:
@@ -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 }]: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user