热更新:handler监听热更新

This commit is contained in:
qiaoxin
2021-07-16 11:29:26 +08:00
parent dc15862207
commit fc1b2c080e
65 changed files with 321 additions and 254 deletions

View File

@@ -1,5 +1,5 @@
import { GroupMessageType } from './../../../db/GroupMessage';
import { Application, ChannelService } from 'pinus';
import { Application, ChannelService, HandlerService, } from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { ON_ADD_CHANNEL_ROUTE, ON_GROUP_MSG_ROUTE, ON_LEAVE_CHANNEL_ROUTE, STATUS, CHANNEL_PREFIX } from '../../../consts';
import { PrivateMessageType } from '../../../db/PrivateMessage';
@@ -12,6 +12,7 @@ import { getAllGuildActivityStatus } from '../../../services/guildActivityServic
import { MailParam } from '../../../domain/roleField/mail';
export default function (app: Application) {
new HandlerService(app, {});
return new ChatRemote(app);
}
@@ -115,7 +116,7 @@ export class ChatRemote {
let channel = this.channelService.getChannel(name, false);
// leave channel
if (!!channel) {
channel.pushMessage('onWorldMessage', resResult(STATUS.SUCCESS, param));
channel.pushMessage('onWorldMessage', resResult(STATUS.SUCCESS, param));
}
}
@@ -181,7 +182,7 @@ export class ChatRemote {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return;
channel.pushMessage(this.GUILD_ACTIVITY_END, resResult(STATUS.SUCCESS, { }));
channel.pushMessage(this.GUILD_ACTIVITY_END, resResult(STATUS.SUCCESS, {}));
}
/**
@@ -192,15 +193,15 @@ export class ChatRemote {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return;
channel.pushMessage(this.RACE_ACTIVITY_START, resResult(STATUS.SUCCESS, { }));
channel.pushMessage(this.RACE_ACTIVITY_START, resResult(STATUS.SUCCESS, {}));
}
/**
* @description 全服推送排行榜更新信息
* @param serverId
*/
public async sendRankTopUpdated(serverId: number, rank: (GeneralRankParamRole|GeneralRankParamBattle)&{general: number}) {
public async sendRankTopUpdated(serverId: number, rank: (GeneralRankParamRole | GeneralRankParamBattle) & { general: number }) {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return;
@@ -245,10 +246,10 @@ export class ChatRemote {
* @param serverId
*/
public async sendServerMaintenance(serverId: number) {
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
let channel = this.channelService.getChannel(roomId, false);
if (!channel) return { result: false, serverId };
if (!channel) return { result: false, serverId };
channel.pushMessage('onServerMaintenance', resResult(STATUS.SERVER_MAINTENANCE));
return { result: true, serverId };
}