聊天:添加最近私聊对象列表

This commit is contained in:
luying
2021-03-29 13:50:19 +08:00
parent c2e563b607
commit f3c2cdb770

View File

@@ -2,7 +2,7 @@ import { CHANNEL_PREFIX, MSG_SOURCE } from './../../../consts/constModules/chatC
import {Application, BackendSession} from 'pinus'; import {Application, BackendSession} from 'pinus';
import { resResult } from '../../../pubUtils/util'; import { resResult } from '../../../pubUtils/util';
import { DEFAULT_MSG_PER_PAGE, STATUS } from '../../../consts'; import { DEFAULT_MSG_PER_PAGE, STATUS } from '../../../consts';
import { createAccuseData, createGroupMsg, createPrivateMsg, getPrivateMessages, pushGroupMsgToRoom, pushMsgToRole, updatePrivateMsgReadInfo } from '../../../services/chatService'; import { createAccuseData, createGroupMsg, createPrivateMsg, getPrivateMessages, pushGroupMsgToRoom, pushMsgToRole, updatePrivateMsgReadInfo, recentPrivateChatInfos } from '../../../services/chatService';
import { getSimpleRoleInfo } from '../../../services/roleService'; import { getSimpleRoleInfo } from '../../../services/roleService';
@@ -121,6 +121,24 @@ export class ChatHandler {
} }
/**
* @description 获取最近私聊对象列表
* @param {{}} msg
* @param session
*/
async getRecentPrivateChats(msg: {}, session: BackendSession) {
const roleId = session.get('roleId');
const roleName = session.get('roleName');
const recentPrivateChats = await recentPrivateChatInfos(roleId, roleName)||[];
return resResult(STATUS.SUCCESS, {
recentPrivateChats
});
}
/** /**
* @description 获取私聊历史消息 * @description 获取私聊历史消息
* @param {{targetRoleId: string, fromSeqId: number, count: number}} msg 聊天对象;聊天消息的顺序 id不传为从最新开始count 为消息条数 * @param {{targetRoleId: string, fromSeqId: number, count: number}} msg 聊天对象;聊天消息的顺序 id不传为从最新开始count 为消息条数