✨ feat(pvp): 巅峰演武战区化
This commit is contained in:
@@ -23,7 +23,7 @@ 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 { ServerGroupModel } from '@db/ServerGroup';
|
||||
import { GVGConfigModel } from '@db/GVGConfig';
|
||||
|
||||
/**
|
||||
@@ -353,14 +353,20 @@ export default class Game extends Service {
|
||||
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 currentGVGTypes = await ServerGroupModel.findByTime(nowSeconds(), 1);
|
||||
const nextGVGTypes = await ServerGroupModel.findByTime(nowSeconds() + 7 * 86400, 1);
|
||||
|
||||
const { seasonEndTime } = await PVPConfigModel.findCurPVPConfig();
|
||||
const currentPVPTypes = await ServerGroupModel.findByTime(nowSeconds(), 2);
|
||||
const nextPVPTypes = await ServerGroupModel.findByTime(seasonEndTime, 2);
|
||||
|
||||
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.serverId);
|
||||
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 }
|
||||
let curGVG = currentGVGTypes.find(obj => obj.serverId == server.id)?.groupId||dic.groupId;
|
||||
let nextGVG = nextGVGTypes.find(obj => obj.serverId == server.id)?.groupId||curGVG;
|
||||
let curPVP = currentPVPTypes.find(obj => obj.serverId == server.id)?.groupId||dic.groupId;
|
||||
let nextPVP = nextPVPTypes.find(obj => obj.serverId == server.id)?.groupId||curPVP;
|
||||
return { id: server.id, serverId: server.serverId, name: server.name, curGVG, nextGVG, curPVP, nextPVP, env: this.app.config.realEnv }
|
||||
});
|
||||
|
||||
return ctx.service.utils.resResult(STATUS.SUCCESS, {
|
||||
|
||||
Reference in New Issue
Block a user