聊天:增加用户信息等字段
This commit is contained in:
@@ -3,6 +3,7 @@ import {Application, BackendSession} from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { DEFAULT_MSG_PER_PAGE, STATUS } from '../../../consts';
|
||||
import { createAccuseData, createGroupMsg, createPrivateMsg, getPrivateMessages, pushGroupMsgToRoom, pushMsgToRole, updatePrivateMsgReadInfo } from '../../../services/chatService';
|
||||
import { getSimpleRoleInfo } from '../../../services/roleService';
|
||||
|
||||
|
||||
export default function(app: Application) {
|
||||
@@ -129,7 +130,8 @@ 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, { targetRoleId, msgs });
|
||||
const targetRoleInfo = await getSimpleRoleInfo(targetRoleId);
|
||||
return resResult(STATUS.SUCCESS, { targetRoleId, msgs, targetRoleInfo });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Application, ChannelService } from 'pinus';
|
||||
import { resResult } from '../../../pubUtils/util';
|
||||
import { ON_ADD_CHANNEL_ROUTE, ON_GROUP_MSG_ROUTE, ON_LEAVE_CHANNEL_ROUTE, STATUS } from '../../../consts';
|
||||
import { PrivateMessageType } from '../../../db/PrivateMessage';
|
||||
import { addUserToChannel } from '../../../services/roleService';
|
||||
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
|
||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -151,7 +151,8 @@ export class ChatRemote {
|
||||
public async sendGroupMsg(roomId: string, msg: Partial<GroupMessageType>) {
|
||||
let channel = this.channelService.getChannel(roomId, false);
|
||||
if (!channel) return;
|
||||
channel.pushMessage(ON_GROUP_MSG_ROUTE, resResult(STATUS.SUCCESS, msg));
|
||||
const roleInfo = await getSimpleRoleInfo(msg.roleId);
|
||||
channel.pushMessage(ON_GROUP_MSG_ROUTE, resResult(STATUS.SUCCESS, { ...msg, roleInfo }));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user