寻宝:一键邀请发送世界消息和测试
This commit is contained in:
@@ -21,7 +21,7 @@ import { setAp } from '../../../services/actionPointService';
|
||||
import { roleLevelup } from '../../../services/normalBattleService';
|
||||
import { addUserToChannel } from '../../../services/roleService';
|
||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||
import { pushComBtlTeamMsg, pushNormalEquipMsg } from '../../../services/chatService';
|
||||
import { pushComBtlTeamMsg, pushNormalEquipMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
||||
|
||||
export default function(app: Application) {
|
||||
return new ComBattleHandler(app);
|
||||
@@ -656,13 +656,29 @@ export class ComBattleHandler {
|
||||
let roleName = session.get('roleName');
|
||||
|
||||
const { teamCode, type, content, targetRoleId, targetMsgCode } = msg;
|
||||
const result = await pushComBtlTeamMsg(teamCode, roleId, roleName, type, MSG_SOURCE.TEAM, content, targetRoleId, targetMsgCode);
|
||||
const result = await pushComBtlTeamMsg(teamCode, roleId, roleName, type, MSG_SOURCE.TEAM_ROLE, content, targetRoleId, targetMsgCode);
|
||||
if (!result) {
|
||||
return resResult(STATUS.WRONG_PARMS);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 一键邀请,自动在世界频道发送消息
|
||||
* @param {{ teamCode: string }} msg
|
||||
* @param {BackendSession} session
|
||||
* @memberof ComBattleHandler
|
||||
*/
|
||||
async autoInvite(msg: { teamCode: string }, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let roleName = session.get('roleName');
|
||||
let serverId = session.get('serverId');
|
||||
const { teamCode } = msg;
|
||||
const msgData = await pushTeamInviteMsg(roleId, roleName, serverId, teamCode);
|
||||
if (!msgData) return resResult(STATUS.WRONG_PARMS);
|
||||
return resResult(STATUS.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 藏宝图合成
|
||||
* @param {{original: Array<{id: number, count: number}>}} msg
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user