系统:停服维护逻辑

This commit is contained in:
luying
2021-07-15 14:40:26 +08:00
parent 352aecfb56
commit 0028c9b992
26 changed files with 348 additions and 50 deletions
@@ -12,6 +12,8 @@ import { SendMailFun } from '../../../services/mailService';
import { GM_MAIL_TYPE } from '../../../consts';
import { RewardInter } from '../../../pubUtils/interface';
import { MarqueeModel } from '../../../db/Marquee';
import { ServerlistModel } from '../../../db/Serverlist';
import { getWorldChannelSid } from '../../../services/chatService';
export default function(app: Application) {
return new GmHandler(app);
}
@@ -183,4 +185,24 @@ export class GmHandler {
}
return resResult(STATUS.SUCCESS);
}
async sendMaintenance(msg: { serverType: string }, session: BackendSession) {
const { serverType } = msg;
let allServers = await ServerlistModel.findByServerType(serverType);
let results = [];
for(let { serverId } of allServers) {
let chatSid = await getWorldChannelSid(serverId);
let result = await this.app.rpc.chat.chatRemote.sendServerMaintenance.toServer(chatSid, serverId);
results.push(result);
}
return resResult(STATUS.SUCCESS, results);
}
async setMaintenance() {
let connectorServers = pinus.app.getServersByType('connector');
for(let { id } of connectorServers) {
pinus.app.rpc.connector.connectorRemote.setServerMainten.toServer(id, [1]);
}
return resResult(STATUS.SUCCESS);
}
}