推送:删除一个无效的频道
This commit is contained in:
@@ -46,92 +46,6 @@ export class ChatRemote {
|
||||
private RANK_TOP_UPDATE = 'onRankTopUpdated';
|
||||
private GUILD_ACTIVITY_STATUS_UPDATE = 'onGuildActivityStatus'; // 军团活动状态变化
|
||||
|
||||
/**
|
||||
* 加入世界频道(分服).
|
||||
*
|
||||
* @param {String} roleId roleId
|
||||
* @param {String} sid server id
|
||||
* @param {String} serverId 区id
|
||||
* @param {boolean} flag 是否创建新channel
|
||||
*
|
||||
*/
|
||||
public async addWorldChannel(roleId: string, serverId: number, sid: string, flag: boolean = true) {
|
||||
try {
|
||||
const name = `world${serverId}`;
|
||||
let channel = this.channelService.getChannel(name, flag);
|
||||
if (!channel) return;
|
||||
channel.add(roleId, sid);
|
||||
let param = {
|
||||
roleId
|
||||
};
|
||||
return this.getWorldChannel(name);
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user from chat channel.
|
||||
*
|
||||
* @param {Object} opts parameters for request
|
||||
* @param {String} name channel name
|
||||
* @param {boolean} flag channel parameter
|
||||
* @return {Array} users uids in channel
|
||||
*
|
||||
*/
|
||||
private getWorldChannel(name: string, flag: boolean = true): Array<any> {
|
||||
let users: string[] = [];
|
||||
let channel = this.channelService.getChannel(name, flag);
|
||||
if (!!channel) {
|
||||
users = channel.getMembers();
|
||||
}
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
users[i] = users[i].split('*')[0];
|
||||
}
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* 踢出世界频道.
|
||||
*
|
||||
* @param {String} roleId roleId
|
||||
* @param {String} sid server id
|
||||
* @param {String} serverId 区id
|
||||
*
|
||||
*/
|
||||
public async kickWorldChannel(roleId: string, sid: string, serverId: number) {
|
||||
try {
|
||||
const name = `world${serverId}`;
|
||||
|
||||
let channel = this.channelService.getChannel(name, false);
|
||||
// leave channel
|
||||
if (!channel) return;
|
||||
channel.leave(roleId, sid);
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向世界频道全服发送消息
|
||||
*
|
||||
* @param serverId 区id
|
||||
* @param param 信息
|
||||
*/
|
||||
public async sendWorldMessage(serverId: number, param: any) {
|
||||
try {
|
||||
const name = `world${serverId}`;
|
||||
|
||||
let channel = this.channelService.getChannel(name, false);
|
||||
// leave channel
|
||||
if (!!channel) {
|
||||
channel.pushMessage('onWorldMessage', resResult(STATUS.SUCCESS, param));
|
||||
}
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 添加用户到频道
|
||||
* @param {string} channelName 频道名
|
||||
|
||||
@@ -73,7 +73,6 @@ export class EntryHandler {
|
||||
|
||||
addRoleToSysChannel(role.roleId, self.app.get('serverId'), role.serverId);
|
||||
addRoleToWorldChannel(role.roleId, self.app.get('serverId'), role.serverId);
|
||||
await self.app.rpc.chat.chatRemote.addWorldChannel.route(session)(role.roleId, serverId, self.app.get('serverId'));
|
||||
reportOneOnline(role.roleId, user.userCode, self.app.get('serverId'), true, user);
|
||||
|
||||
// 任务
|
||||
@@ -190,7 +189,6 @@ export class EntryHandler {
|
||||
let channelService = this.app.get('channelService');
|
||||
let channel = channelService.getChannel(roleId, true);
|
||||
channel.leave(roleId, sid);
|
||||
this.app.rpc.chat.chatRemote.kickWorldChannel.route(session, true)(roleId, sid, serverId);
|
||||
await leaveSysChannel(roleId, sid, serverId);
|
||||
await leaveWorldChannel(roleId, sid, serverId);
|
||||
await leaveGuildChannel(roleId, sid, guildCode);
|
||||
|
||||
Reference in New Issue
Block a user