聊天:添加跑马灯功能

This commit is contained in:
luying
2021-07-02 17:23:18 +08:00
parent 4fce369680
commit e9280a38c9
8 changed files with 187 additions and 1 deletions
@@ -11,6 +11,7 @@ import { dispatch } from '../../../util/dispatcher';
import { SendMailFun } from '../../../services/mailService';
import { GM_MAIL_TYPE } from '../../../consts';
import { RewardInter } from '../../../pubUtils/interface';
import { MarqueeModel } from '../../../db/Marquee';
export default function(app: Application) {
return new GmHandler(app);
}
@@ -154,4 +155,21 @@ export class GmHandler {
});
}
}
async createMarquee(msg: { startTime: string, endTime: string, interval: number, content: string }, session: BackendSession) {
const { startTime, endTime, interval, content } = msg;
let marquee = await MarqueeModel.createData({ serverIds: [1], type: 2, startTime: new Date(startTime), endTime: new Date(endTime), interval, content });
return resResult(STATUS.SUCCESS, {
code: marquee.code
});
}
async sendMarquee(msg: { code: string }, session: BackendSession) {
const { code } = msg;
let systimerServers = this.app.getServersByType('systimer');
for(let { id } of systimerServers) {
await this.app.rpc.systimer.systimerRemote.setMarquee.toServer(id, code);
}
return resResult(STATUS.SUCCESS);
}
}