diff --git a/game-server/app/servers/chat/handler/chatHandler.ts b/game-server/app/servers/chat/handler/chatHandler.ts index 4f4e2f279..59bd9178e 100644 --- a/game-server/app/servers/chat/handler/chatHandler.ts +++ b/game-server/app/servers/chat/handler/chatHandler.ts @@ -1,3 +1,4 @@ +import { CHANNEL_PREFIX } from './../../../consts/constModules/chatConst'; import {Application, BackendSession} from 'pinus'; import { resResult } from '../../../pubUtils/util'; import { DEFAULT_MSG_PER_PAGE, STATUS } from '../../../consts'; @@ -79,6 +80,7 @@ export class 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; + 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); diff --git a/game-server/test/chat.test.ts b/game-server/test/chat.test.ts index e74b14456..e9c577d35 100644 --- a/game-server/test/chat.test.ts +++ b/game-server/test/chat.test.ts @@ -113,7 +113,8 @@ describe('聊天测试', function() { }); it('测试系统频道消息', function(done) { - testGroupMsg(pinusClient, roleInfo, pinusClientT, CHANNEL_PREFIX.SYS, roleInfo.serverId, done); + // TODO: 玩家无法在系统频道发送消息,需要添加系统推送的监听测试 + done(); }); it('测试世界频道消息', function(done) { diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index ffa93e871..10ce968e3 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -265,6 +265,7 @@ export const STATUS = { FRIEND_HAS_RECEIVE: { code: 30713, simStr: '领取达到上限' }, // 社交相关状态 40000 - 49999 + SYS_CHANNEL_AUTH_NOT_ENOUGH: {code: 40000, simStr: '无法在系统频道发送消息'}, // 运营模块相关状态 50000 - 59999 // GM后台相关状态 60000 - 69999 GM_ERR_PASSWORD: { code: 60001, simStr: '账号或密码错误' },