From 2fbe6102cddd3a276c81d417f8efd73d7d21919c Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 25 Oct 2021 20:24:26 +0800 Subject: [PATCH] pb file --- src/msg_gateway/gate/logic.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/msg_gateway/gate/logic.go b/src/msg_gateway/gate/logic.go index 098f47636..2781e90e5 100644 --- a/src/msg_gateway/gate/logic.go +++ b/src/msg_gateway/gate/logic.go @@ -11,7 +11,6 @@ import ( "bytes" "context" "encoding/gob" - "encoding/json" "fmt" "github.com/golang/protobuf/proto" "github.com/gorilla/websocket" @@ -104,22 +103,15 @@ func (ws *WServer) newestSeqReq(conn *UserConn, m *Req) { func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) { var mReplyData pbWs.PullMessageBySeqListResp - mReplyData.MaxSeq = pb.GetMaxSeq() - mReplyData.MinSeq = pb.GetMinSeq() - b, err := json.Marshal(pb.GetSingleUserMsg) + b, err := proto.Marshal(pb) if err != nil { log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error()) } log.NewInfo(m.OperationID, "pullMsgResp json is ", string(b)) - err = json.Unmarshal(b, &mReplyData.SingleUserMsg) + err = proto.Unmarshal(b, &mReplyData) if err != nil { log.NewError(m.OperationID, "SingleUserMsg,json Unmarshal,err", err.Error()) } - b, _ = json.Marshal(pb.GetGroupUserMsg()) - err = json.Unmarshal(b, &mReplyData.GroupUserMsg) - if err != nil { - log.NewError(m.OperationID, "GroupUserMsg,json Unmarshal,err", err.Error()) - } c, _ := proto.Marshal(&mReplyData) mReply := Resp{ ReqIdentifier: m.ReqIdentifier,