✨ feat(服务器): 多服务器开服
This commit is contained in:
@@ -20,6 +20,7 @@ import { ChannelInfoModel } from '@db/ChannelInfo';
|
||||
import { GVGVestigeRecModel } from '@db/GVGVestigeRec';
|
||||
import { GVGBattleRecModel } from '@db/GVGBattleRec';
|
||||
import { PackageModel } from '@db/Package';
|
||||
import { nowSeconds } from 'app/pubUtils/timeUtil';
|
||||
const sendToWormhole = require('stream-wormhole');
|
||||
const pump = require('mz-modules/pump');
|
||||
|
||||
@@ -112,6 +113,20 @@ export default class GameController extends Controller {
|
||||
allServers = allServers.filter(server => !pkg.hideServers.includes(server.id));
|
||||
}
|
||||
}
|
||||
// 新开服的展示 需要提前12小时,超过12小时不在前端展示即将开启
|
||||
// 新开服的数量有且仅显示一个,目的为了防止1天多个服导致出来多个即将开启
|
||||
let hideFutureServerIds: number[] = [], showFutureServerIds: number[] = [];
|
||||
for(let server of allServers) {
|
||||
if(server.openTime > nowSeconds() + 12 * 60 * 60) hideFutureServerIds.push(server.id);
|
||||
if(server.openTime > nowSeconds() && server.openTime <= nowSeconds() + 12 * 60 * 60) showFutureServerIds.push(server.id);
|
||||
}
|
||||
if(showFutureServerIds.length > 0) {
|
||||
showFutureServerIds.sort((a, b) => b - a);
|
||||
hideFutureServerIds.push(...showFutureServerIds.slice(0, showFutureServerIds.length -1))
|
||||
}
|
||||
if(hideFutureServerIds.length > 0) {
|
||||
allServers = allServers.filter(server => !hideFutureServerIds.includes(server.id));
|
||||
}
|
||||
|
||||
let roles = await RoleModel.findAllByUid(uid, true, true);
|
||||
for (let server of allServers) {
|
||||
|
||||
Reference in New Issue
Block a user