后台:停服维护
This commit is contained in:
@@ -14,6 +14,8 @@ import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { MarqueeModel } from '../../../db/Marquee';
|
||||
import { ServerlistModel } from '../../../db/Serverlist';
|
||||
import { getWorldChannelSid } from '../../../services/chatService';
|
||||
import { MaintenanceModel } from '../../../db/Maintenance';
|
||||
import { initMaintenance, stopMaintenance } from '../../../services/gmService';
|
||||
export default function(app: Application) {
|
||||
return new GmHandler(app);
|
||||
}
|
||||
@@ -186,16 +188,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 startMaintenance(msg: { code: string }, session: BackendSession) {
|
||||
const { code } = msg;
|
||||
const uid = session.get('uid');
|
||||
const maintenance = await MaintenanceModel.updateStatusByCode(code, true, uid);
|
||||
if(!maintenance) return resResult(STATUS.WRONG_PARMS);
|
||||
await initMaintenance(maintenance);
|
||||
|
||||
return resResult(STATUS.SUCCESS,);
|
||||
}
|
||||
|
||||
async stopMaintenance(msg: { code: string }, session: BackendSession) {
|
||||
const { code } = msg;
|
||||
const uid = session.get('uid');
|
||||
const maintenance = await MaintenanceModel.updateStatusByCode(code, false, uid);
|
||||
if(!maintenance) return resResult(STATUS.WRONG_PARMS);
|
||||
await stopMaintenance(maintenance);
|
||||
|
||||
return resResult(STATUS.SUCCESS,);
|
||||
}
|
||||
|
||||
async setMaintenance() {
|
||||
|
||||
Reference in New Issue
Block a user