寻宝:信息边窗

This commit is contained in:
luying
2022-07-07 13:27:43 +08:00
parent b1dc091453
commit 460d0d6955
15 changed files with 153 additions and 38 deletions
+14 -10
View File
@@ -13,7 +13,9 @@ import { getRoleOnlineInfo } from './redisService';
import { ChatInfoModel } from '../db/ChatInfo';
import { AccuseRecModel, AccueseParam } from '../db/AccuseRec';
import { getSimpleRoleInfo, getSimpleRoleInfos } from './roleService';
import { sendMessageToCityWithSuc, sendMessageToGuildWithSuc, sendMessageToServerWithSuc, sendMessageToTeam, sendMessageToUserWithSuc } from './pushService';
import { sendMessageToAllWithSuc, sendMessageToCityWithSuc, sendMessageToGuildWithSuc, sendMessageToServerWithSuc, sendMessageToTeam, sendMessageToUserWithSuc } from './pushService';
import { comBtlLvInvalid } from './comBattleService';
import { gameData } from '../pubUtils/data';
export * from './chatChannelService';
export * from './sysChatService';
@@ -163,6 +165,12 @@ export async function pushGroupMsgToRoom(msg: GroupMessageType) {
}
}
export async function pushGroupMsgToAll(msg: GroupMessageType, filterCb?: ({ lv, topLineupCe }) => boolean) {
if (!msg) return;
const roleInfo = await getSimpleRoleInfo(msg.roleId);
await sendMessageToAllWithSuc(PUSH_ROUTE.GROUP_MSG, { ...msg, roleInfo }, filterCb);
}
/**
* @description 获取私聊历史消息
* @export
@@ -369,16 +377,12 @@ export async function delPrivateMsg(roleId: string, targetRoleId: string) {
* @description 发送组队一键邀请消息
* @param {string} teamCode 队伍唯一标识
*/
export async function pushTeamInviteMsg(roleId: string, roleName: string, serverId: number, guildCode: string, teamCode: string, blueprtId: number) {
export async function pushTeamInviteMsg(roleId: string, roleName: string, serverId: number, teamCode: string, blueprtId: number, blueprtLv: number, ceLimit: number) {
let msgDataWorld = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.WORLD, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.TEAM_INVITE, JSON.stringify({ roleName, teamCode, blueprtId }), null, null);
await pushGroupMsgToRoom(msgDataWorld);
let msgDataGuild: GroupMessageType;
if(guildCode) {
msgDataGuild = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, `${guildCode}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.TEAM_INVITE, JSON.stringify({ roleName, teamCode, blueprtId }), null, null);
await pushGroupMsgToRoom(msgDataGuild);
}
return { msgDataWorld, msgDataGuild };
await pushGroupMsgToAll(msgDataWorld, (data: {lv: number, topLineupCe: number}) => {
return data.topLineupCe >= ceLimit && !comBtlLvInvalid(data.lv, [blueprtLv]);
});
return { msgDataWorld };
}
/**