聊天:军团修改公告的推送和测试

This commit is contained in:
liangtongchuan
2021-03-09 17:02:23 +08:00
parent 109d643544
commit 130bbc3be6
4 changed files with 60 additions and 7 deletions
+12 -1
View File
@@ -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;
}