聊天:测试机制,添加部分接口的壳子

This commit is contained in:
liangtongchuan
2021-03-03 20:45:54 +08:00
parent 3f2f4d410b
commit fd5df13be1
2 changed files with 82 additions and 0 deletions

View File

@@ -69,4 +69,43 @@ export class ChatHandler {
}]);
}
}
/**
* @description 群聊发送接口
* @param {{ channel: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }} msg
* @param {BackendSession} session
* @memberof ChatHandler
*/
async sendGroupMessage(msg: { channel: string, type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
const { channel, type, content, targetRoleId, targetMsgCode } = msg;
}
/**
* @description 私聊发送接口
* @param {{ type: number, content: string, targetRoleId: string, targetMsgCode: string }} msg
* @param {BackendSession} session
* @memberof ChatHandler
*/
async sendPrivateMessage(msg: { type: number, content: string, targetRoleId: string, targetMsgCode: string }, session: BackendSession) {
const { type, content, targetRoleId, targetMsgCode } = msg;
}
/**
* @description 获取初始聊天消息,数据和登录时返回的一致
* @param {{}} msg
* @memberof ChatHandler
*/
async getInitMessage(msg: {}) {
}
/**
* @description 获取私聊历史消息
* @param {{targetRoleId: string, fromSeqId: number, count: number}} msg 聊天对象;聊天消息的顺序 id不传为从最新开始count 为消息条数
* @memberof ChatHandler
*/
async getPrivateMessage(msg: {targetRoleId: string, fromSeqId: number, count: number}) {
}
}

View File

@@ -1,6 +1,8 @@
import { GroupMessageType } from './../../../db/GroupMessage';
import { Application, ChannelService, FrontendSession, RemoterClass, pinus } from 'pinus';
import { resResult } from '../../../pubUtils/util';
import { STATUS } from '../../../consts';
import { PrivateMessageType } from '../../../db/PrivateMessage';
export default function (app: Application) {
return new ChatRemote(app);
@@ -109,4 +111,45 @@ export class ChatRemote {
channel.pushMessage('onWorldMessage', resResult(STATUS.SUCCESS, param));
}
}
/**
* @description 添加用户到频道
* @param {string} channelName 频道名
* @param {string} roleId 要添加的用户名
* @param {string} sid 用户连接的前端服务器名
* @memberof ChatRemote
*/
public async addChannel(channelName: string, roleId: string, sid: string) {
}
/**
* @description 从频道中删除用户
* @param {string} channelName
* @param {string} roleId
* @param {string} sid
* @memberof ChatRemote
*/
public async leaveChannel(channelName: string, roleId: string, sid: string) {
}
/**
* @description 推送群消息到频道
* @param {Partial<GroupMessageType>} msg
* @memberof ChatRemote
*/
public async sendGroupMsg(msg: Partial<GroupMessageType>) {
}
/**
* @description 推送私聊消息
* @param {Partial<PrivateMessageType>} msg
* @memberof ChatRemote
*/
public async sendPrivateMsg(msg: Partial<PrivateMessageType>) {
}
}