系统:停服维护逻辑
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user