后台:跑马灯

This commit is contained in:
luying
2021-12-09 20:38:23 +08:00
parent 3db2735d6e
commit ecca95b40b
12 changed files with 187 additions and 94 deletions
@@ -12,6 +12,7 @@ import { SendMailFun } from '../../../services/mailService';
import { createNewServer, sendOpenServerMail } from '../../../services/gmService';
import { initAutoCreateServer, initMaintenance, stopMaintenance } from '../../../services/timeTaskService';
import { isNumber } from 'util';
import { MarqueeModel } from '../../../db/Marquee';
let timer: NodeJS.Timer;
export default function (app: Application) {
return new GmHandler(app);
@@ -101,4 +102,23 @@ export class GmHandler {
return resResult(STATUS.SUCCESS,);
}
async sendMarquee(msg: { code: string }, session: BackendSession) {
const { code } = msg;
let marquee = await MarqueeModel.findByCode(code);
if(!marquee) return resResult(STATUS.DB_DATA_NOT_FOUND);
await MarqueeModel.updateData(code, { isEnable: true });
let result = await this.app.rpc.systimer.systimerRemote.setMarquee.broadcast(marquee);
if (!result) return resResult(STATUS.GM_MARQUEE_ERR);
return resResult(STATUS.SUCCESS);
}
async cancelMarquee(msg: { code: string }, session: BackendSession) {
const { code } = msg;
await MarqueeModel.updateData(code, { isEnable: false });
let result = await this.app.rpc.systimer.systimerRemote.cancelMarquee.broadcast(code);
if (!result) return resResult(STATUS.GM_MARQUEE_CANCEL_ERR);
return resResult(STATUS.SUCCESS);
}
}