聊天:修改部分接口字段和命名

This commit is contained in:
liangtongchuan
2021-03-11 17:01:15 +08:00
parent 75fb82316d
commit 3bbd8627bd
8 changed files with 27 additions and 18 deletions

View File

@@ -78,11 +78,17 @@ export class ChatHandler {
* @param {BackendSession} session
* @memberof ChatHandler
*/
async sendGroupMessage(msg: { channel: string, channelId: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
const { channel, channelId, type, content, targetRoleId, targetMsgCode } = msg;
async sendGroupMessage(msg: { channel: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
const { channel, type, content, targetRoleId, targetMsgCode } = msg;
if (channel === CHANNEL_PREFIX.SYS) return resResult(STATUS.SYS_CHANNEL_AUTH_NOT_ENOUGH);
const roleId = session.get('roleId');
const roleName = session.get('roleName');
const serverId = session.get('serverId');
const guildCode = session.get('guildCode');
let channelId = '';
if (channel === CHANNEL_PREFIX.WORLD) channelId = `${serverId}`;
if (channel === CHANNEL_PREFIX.GUILD) channelId = guildCode;
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
await pushGroupMsgToRoom(msgData);
@@ -123,7 +129,7 @@ export class ChatHandler {
const roleId = session.get('roleId');
const { targetRoleId, fromSeqId = Infinity, count = DEFAULT_MSG_PER_PAGE } = msg;
const msgs = await getPrivateMessages(roleId, targetRoleId, fromSeqId, count);
return resResult(STATUS.SUCCESS, { msgs });
return resResult(STATUS.SUCCESS, { targetRoleId, msgs });
}
/**