聊天:推送部分军团消息
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { BossInstanceType } from './../db/BossInstance';
|
||||
import { isString } from 'underscore';
|
||||
import { cloneDeep, pick } from 'lodash';
|
||||
import { cloneDeep, isArray, pick } from 'lodash';
|
||||
import { RoleModel } from './../db/Role';
|
||||
import { GroupMessageModel } from './../db/GroupMessage';
|
||||
import { CounterModel } from './../db/Counter';
|
||||
@@ -13,6 +14,7 @@ import { addRedisChannel, getRoleOnlineInfo, redisChannelServer } from './redisS
|
||||
import { crc32 } from 'crc';
|
||||
import { HeroType } from '../db/Hero';
|
||||
import { GuildType } from '../db/Guild';
|
||||
import { GuildTrainType } from '../db/GuildTrain';
|
||||
|
||||
/**
|
||||
* @description 生成私聊房间号
|
||||
@@ -241,3 +243,32 @@ export async function pushGuildNoticeUpdateMsg(roleId: string, roleName: string,
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.GUILD, code), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushGuildUpStructureMsg(roleId: string, roleName: string, guildInfo: Partial<GuildType>) {
|
||||
const { code, structure } = guildInfo;
|
||||
if (!code || !structure || !isArray(structure)) return null;
|
||||
const guild = pick(guildInfo, ['code', 'structure']);
|
||||
const content = JSON.stringify({ roleId, roleName, guild });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, code, MSG_TYPE.TEXT, MSG_SOURCE.GUILD_STRUCTURE_LV_UP, content, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.GUILD, code), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushGuildTrainSucMsg(roleId: string, roleName: string, guildCode: string, hid: number) {
|
||||
if (!guildCode) return null;
|
||||
const content = JSON.stringify({ hid });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, guildCode, MSG_TYPE.TEXT, MSG_SOURCE.GUILD_TRAIN_SUC, content, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.GUILD, guildCode), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushGuildBossSucMsg(roleId: string, roleName: string, guildCode: string, bossInstance: BossInstanceType) {
|
||||
const boss = pick(bossInstance, ['warId', 'bossLv']);
|
||||
const content = JSON.stringify({ boss });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, guildCode, MSG_TYPE.TEXT, MSG_SOURCE.GUILD_BOSS_SUC, content, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.GUILD, guildCode), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user