聊天:加入部分假数据;加入一个服务器群推

This commit is contained in:
liangtongchuan
2021-03-07 21:25:36 +08:00
parent e0984cc932
commit ba70750f09
7 changed files with 126 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
import { CHANNEL_PREFIX } from './../../../consts/constModules/chatConst';
import { CHANNEL_PREFIX, MSG_SOURCE } from './../../../consts/constModules/chatConst';
import {Application, BackendSession} from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { DEFAULT_MSG_PER_PAGE, STATUS } from '../../../consts';
@@ -83,7 +83,7 @@ export class ChatHandler {
if (channel === CHANNEL_PREFIX.SYS) return resResult(STATUS.SYS_CHANNEL_AUTH_NOT_ENOUGH);
const roleId = session.get('roleId');
const roleName = session.get('roleName');
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, content, targetRoleId, targetMsgCode);
const msgData = await createGroupMsg(roleId, roleName, channel, channelId, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
await pushGroupMsgToRoom(groupRoomId(channel, channelId), msgData);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS);
@@ -99,7 +99,7 @@ export class ChatHandler {
const { type, content, targetRoleId, targetMsgCode } = msg;
const roleId = session.get('roleId');
const roleName = session.get('roleName');
const msgData = await createPrivateMsg(roleId, roleName, type, content, targetRoleId, targetMsgCode);
const msgData = await createPrivateMsg(roleId, roleName, type, MSG_SOURCE.ROLE_SEND_TEXT, content, targetRoleId, targetMsgCode);
await pushMsgToRole(targetRoleId, msgData);
if (!msgData) return resResult(STATUS.WRONG_PARMS);
return resResult(STATUS.SUCCESS, msgData);