热更新:handler监听热更新
This commit is contained in:
@@ -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 };
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { Application, ChannelService, HandlerService, } from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { STATUS, CHANNEL_PREFIX } from '../../../consts';
|
||||
import { GuildType } from '../../../db/Guild';
|
||||
@@ -9,6 +9,7 @@ import { GuildRankParams, WoodenHorse, Event } from '../../../domain/battleField
|
||||
import { MailParam } from '../../../domain/roleField/mail';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
return new GuildRemote(app);
|
||||
}
|
||||
|
||||
@@ -301,7 +302,7 @@ export class GuildRemote {
|
||||
* @param path 推送地址
|
||||
* @param data 军团内容
|
||||
*/
|
||||
public async sendMailToGuild(guildCode: string, path: string, data: { mails: MailParam[]}) {
|
||||
public async sendMailToGuild(guildCode: string, path: string, data: { mails: MailParam[] }) {
|
||||
this.pushMessage(guildCode, path, data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user