pull/103/head
Gordon 3 years ago
parent 219e97f3f6
commit 2fbe6102cd

@ -11,7 +11,6 @@ import (
"bytes" "bytes"
"context" "context"
"encoding/gob" "encoding/gob"
"encoding/json"
"fmt" "fmt"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/gorilla/websocket" "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) { func (ws *WServer) pullMsgResp(conn *UserConn, m *Req, pb *pbChat.PullMessageResp) {
var mReplyData pbWs.PullMessageBySeqListResp var mReplyData pbWs.PullMessageBySeqListResp
mReplyData.MaxSeq = pb.GetMaxSeq() b, err := proto.Marshal(pb)
mReplyData.MinSeq = pb.GetMinSeq()
b, err := json.Marshal(pb.GetSingleUserMsg)
if err != nil { if err != nil {
log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error()) log.NewError(m.OperationID, "GetSingleUserMsg,json marshal,err", err.Error())
} }
log.NewInfo(m.OperationID, "pullMsgResp json is ", string(b)) log.NewInfo(m.OperationID, "pullMsgResp json is ", string(b))
err = json.Unmarshal(b, &mReplyData.SingleUserMsg) err = proto.Unmarshal(b, &mReplyData)
if err != nil { if err != nil {
log.NewError(m.OperationID, "SingleUserMsg,json Unmarshal,err", err.Error()) 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) c, _ := proto.Marshal(&mReplyData)
mReply := Resp{ mReply := Resp{
ReqIdentifier: m.ReqIdentifier, ReqIdentifier: m.ReqIdentifier,

Loading…
Cancel
Save