聊天:军团修改公告的推送和测试
This commit is contained in:
@@ -21,6 +21,7 @@ import { openGuildRefine } from '../../../services/guildRefineService';
|
||||
import { unlockTrain } from '../../../services/guildTrainService';
|
||||
import { removeBossRank } from '../../../services/guildBossService';
|
||||
import { removeTrainRank } from '../../../services/guildTrainService';
|
||||
import { pushGuildNoticeUpdateMsg } from '../../../services/chatService';
|
||||
export default function (app: Application) {
|
||||
return new GuildHandler(app);
|
||||
}
|
||||
@@ -118,6 +119,7 @@ export class GuildHandler {
|
||||
async setGuildInfo(msg: { code: string, name: string, notice: string, introduce: string, ceLimit: number, isAuto: boolean }, session: BackendSession) {
|
||||
|
||||
const roleId = session.get('roleId');
|
||||
const roleName = session.get('roleName');
|
||||
const { code, name, notice, introduce, ceLimit, isAuto } = msg;
|
||||
if(!name) return resResult(STATUS.WRONG_PARMS);
|
||||
|
||||
@@ -129,9 +131,11 @@ export class GuildHandler {
|
||||
this.app.rpc.chat.guildRemote.updateInfo.toServer(CHAT_SERVER, code, { name, notice, introduce, ceLimit, isAuto });
|
||||
|
||||
await redisUserInfoUpdate(REDIS_KEY.GUILD_INFO, code, [{ field: 'name', value: name }]);
|
||||
if (notice) {
|
||||
pushGuildNoticeUpdateMsg(roleId, roleName, guild);
|
||||
}
|
||||
// 返回
|
||||
return resResult(STATUS.SUCCESS, { ...guild });
|
||||
|
||||
}
|
||||
|
||||
// 游客查看军团详细信息
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isString } from 'underscore';
|
||||
import { cloneDeep, pick } from 'lodash';
|
||||
import { RoleModel } from './../db/Role';
|
||||
import { GroupMessageModel } from './../db/GroupMessage';
|
||||
@@ -11,6 +12,7 @@ import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_SOURCE, MSG_STATUS, MSG_TYPE, ON_GROU
|
||||
import { addRedisChannel, getRoleOnlineInfo, redisChannelServer } from './redisService';
|
||||
import { crc32 } from 'crc';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { GuildType } from '../db/Guild';
|
||||
|
||||
/**
|
||||
* @description 生成私聊房间号
|
||||
@@ -203,7 +205,7 @@ export function wrapRichText(type: string, jumpTo: string, content: string, parm
|
||||
});
|
||||
}
|
||||
|
||||
export async function pushNormalHeroInfoBySource(roleId: string, roleName: string, serverId: number | string, source: number, heroInfo: Partial<HeroType>) {
|
||||
async function pushNormalHeroInfoBySource(roleId: string, roleName: string, serverId: number | string, source: number, heroInfo: Partial<HeroType>) {
|
||||
const hero = pick(heroInfo, ['hName', 'hid', 'seqId', 'quality', 'star', 'starStage', 'colorStar', 'colorStarStage']);
|
||||
const content = JSON.stringify({ roleId, roleName, hero });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, source, content, null, null);
|
||||
@@ -230,3 +232,12 @@ export async function pushComBtlTeamMsg(teamCode: string, roleId: string, roleNa
|
||||
channel.pushMessage(ON_GROUP_MSG_ROUTE, resResult(STATUS.SUCCESS, msgData));
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushGuildNoticeUpdateMsg(roleId: string, roleName: string, guildInfo: Partial<GuildType>) {
|
||||
const { code, notice } = guildInfo;
|
||||
if (!code || !isString(notice)) return null;
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, code, MSG_TYPE.TEXT, MSG_SOURCE.GUILD_NOTICE, notice, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.GUILD, code), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user