聊天:军团建筑升级只推送升级的数据

This commit is contained in:
liangtongchuan
2021-03-18 15:10:58 +08:00
parent 692aa6ac43
commit 9bb07f5b21
2 changed files with 5 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import { GuildType } from '../db/Guild';
import { CHANNEL_PREFIX, HERO_GROW_MAX, HERO_INITIAL_QUALITY, MSG_SOURCE, MSG_TYPE, ON_GROUP_MSG_ROUTE, STATUS, WAR_TYPE } from '../consts';
import { createGroupMsg, pushGroupMsgToRoom } from './chatService';
import { pick } from 'lodash';
import { isArray, isString } from 'underscore';
import { isString } from 'underscore';
import { pinus } from 'pinus';
import { resResult } from '../pubUtils/util';
import { BossInstanceType } from '../db/BossInstance';
@@ -53,10 +53,9 @@ export async function pushGuildNoticeUpdateMsg(roleId: string, roleName: string,
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', 'name']);
export async function pushGuildUpStructureMsg(roleId: string, roleName: string, guildInfo: Partial<GuildType>, structure: {id: number, lv: number}) {
const { code, name } = guildInfo;
const guild = { code, name, structure };
const content = JSON.stringify({ roleId, roleName, guild });
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, code, MSG_TYPE.RICH_TEXT, MSG_SOURCE.GUILD_STRUCTURE_LV_UP, content, null, null);
await pushGroupMsgToRoom(msgData);