From cbed698a1c50e11af1a00806e5bbfc9998fcda1c Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Thu, 20 Jan 2022 18:36:30 +0800 Subject: [PATCH] msg test --- internal/rpc/msg/pull_message.go | 4 ++-- pkg/common/db/mongoModel.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/rpc/msg/pull_message.go b/internal/rpc/msg/pull_message.go index d4b8ec0e6..05f1dad39 100644 --- a/internal/rpc/msg/pull_message.go +++ b/internal/rpc/msg/pull_message.go @@ -39,10 +39,10 @@ func (rpc *rpcChat) GetMaxAndMinSeq(_ context.Context, in *pbMsg.GetMaxAndMinSeq func (rpc *rpcChat) PullMessageBySeqList(_ context.Context, in *open_im_sdk.PullMessageBySeqListReq) (*open_im_sdk.PullMessageBySeqListResp, error) { log.NewInfo(in.OperationID, "rpc PullMessageBySeqList is arriving", in.String()) resp := new(open_im_sdk.PullMessageBySeqListResp) - msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList) + msgList, err := commonDB.DB.GetMsgBySeqList(in.UserID, in.SeqList, in.OperationID) if err != nil { log.ErrorByKv("PullMessageBySeqList data error", in.OperationID, in.String()) - resp.ErrCode = 1 + resp.ErrCode = 201 resp.ErrMsg = err.Error() return resp, nil } diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 6538d17f4..1ea86d004 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -61,7 +61,7 @@ func (d *DataBases) GetMinSeqFromMongo(uid string) (MinSeq uint32, err error) { } return MinSeq, nil } -func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32) (seqMsg []*open_im_sdk.MsgData, err error) { +func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32, operationID string) (seqMsg []*open_im_sdk.MsgData, err error) { var hasSeqList []uint32 singleCount := 0 session := d.mgoSession.Clone() @@ -86,14 +86,14 @@ func (d *DataBases) GetMsgBySeqList(uid string, seqList []uint32) (seqMsg []*ope sChat := UserChat{} for seqUid, value := range m { if err = c.Find(bson.M{"uid": seqUid}).One(&sChat); err != nil { - log.NewError("", "not find seqUid", seqUid, value, uid, seqList) + log.NewError(operationID, "not find seqUid", seqUid, value, uid, seqList, err.Error()) continue } singleCount = 0 for i := 0; i < len(sChat.Msg); i++ { msg := new(open_im_sdk.MsgData) if err = proto.Unmarshal(sChat.Msg[i].Msg, msg); err != nil { - log.NewError("", "not find seqUid", seqUid, value, uid, seqList) + log.NewError(operationID, "Unmarshal err", seqUid, value, uid, seqList, err.Error()) return nil, err } if isContainInt32(msg.Seq, value) {