From 1a3030da01987991efe4e32b388975e6907de61a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Wed, 19 Oct 2022 10:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E8=81=8A=E5=A4=A9=E7=A7=81?= =?UTF-8?q?=E8=81=8A=E9=A2=91=E9=81=93=E4=B8=BA=E8=B7=A8=E6=9C=8D=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/chat/api_send.go | 39 +++++++++++++++++------------------ modules/chat/api_sendcross.go | 8 +++++++ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go index ca64ecd0f..e9e1e1815 100644 --- a/modules/chat/api_send.go +++ b/modules/chat/api_send.go @@ -87,26 +87,25 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code return } break - case pb.ChatChannel_Private: - msg.Ruid = req.TargetId - if err = this.module.PushUser(msg); err != nil { - code = pb.ErrorCode_DBError - return - } - session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) - break - // case pb.ChatChannel_CrossServer: - // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { - // code = pb.ErrorCode_DBError - // return - // } - // msg.ChannelId = userexpand.Chatchannel //指定频道 - // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil { - // code = pb.ErrorCode_DBError - // return - // } - // this.module.PushToUsers(userexpand.Chatchannel, msg) - break + // case pb.ChatChannel_Private: + // msg.Ruid = req.TargetId + // if err = this.module.PushUser(msg); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) + // break + // case pb.ChatChannel_CrossServer: + // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // msg.ChannelId = userexpand.Chatchannel //指定频道 + // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil { + // code = pb.ErrorCode_DBError + // return + // } + // this.module.PushToUsers(userexpand.Chatchannel, msg) default: code = pb.ErrorCode_ReqParameterError this.module.Errorf("getlist no support channel:%d ", req.Channel) diff --git a/modules/chat/api_sendcross.go b/modules/chat/api_sendcross.go index 0c4140df3..82cc955ce 100644 --- a/modules/chat/api_sendcross.go +++ b/modules/chat/api_sendcross.go @@ -87,6 +87,14 @@ func (this *apiComp) SendCross(session comm.IUserSession, req *pb.ChatSendCrossR // } // session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) // break + case pb.ChatChannel_Private: + msg.Ruid = req.TargetId + if err = this.module.PushUser(msg); err != nil { + code = pb.ErrorCode_DBError + return + } + session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) + break case pb.ChatChannel_CrossServer: if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { code = pb.ErrorCode_DBError