寻宝:一键邀请发送世界消息和测试

This commit is contained in:
liangtongchuan
2021-03-11 15:09:20 +08:00
parent fd25fefd91
commit 777b657650
4 changed files with 66 additions and 4 deletions
+11 -1
View File
@@ -7,7 +7,7 @@ import { PrivateMessageModel, PrivateMessageParam, PrivateMessageType } from './
import { GroupMessageParam, GroupMessageType } from '../db/GroupMessage';
import { genCode, resResult } from '../pubUtils/util';
import { pinus } from 'pinus';
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_STATUS, ON_MSG_ROUTE, RECENT_PRIVATE_CHATS_CNT, RECENT_GROUP_MSGS_CNT } from '../consts';
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_STATUS, ON_MSG_ROUTE, RECENT_PRIVATE_CHATS_CNT, RECENT_GROUP_MSGS_CNT, MSG_TYPE, MSG_SOURCE } from '../consts';
import { getRoleOnlineInfo } from './redisService';
import { ChatInfoModel } from '../db/ChatInfo';
import { channelServer } from './chatChannelService';
@@ -285,3 +285,13 @@ export async function updatePrivateMsgReadInfo(roleId: string, targetRoleId: str
const chatRec = chatInfo.recentPrivateChats.find(rec => { return rec.targetRoleId === targetRoleId });
return chatRec;
}
/**
* @description 发送组队一键邀请消息
* @param {string} teamCode 队伍唯一标识
*/
export async function pushTeamInviteMsg(roleId: string, roleName: string, serverId: number, teamCode: string) {
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.WORLD, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.TEAM_INVITE, teamCode, null, null);
await pushGroupMsgToRoom(msgData);
return msgData;
}