From 4c305b7cc0378dd96dec9dca96ea7011db28adbc Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Tue, 31 May 2022 15:18:54 +0800 Subject: [PATCH] redis replace go redis --- pkg/common/db/newRedisModel.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/common/db/newRedisModel.go b/pkg/common/db/newRedisModel.go index 912902b1e..deb932a0f 100644 --- a/pkg/common/db/newRedisModel.go +++ b/pkg/common/db/newRedisModel.go @@ -7,10 +7,9 @@ import ( pbCommon "Open_IM/pkg/proto/sdk_ws" "Open_IM/pkg/utils" "context" - "encoding/json" "errors" "fmt" - "github.com/golang/protobuf/proto" + "github.com/mitchellh/mapstructure" "strconv" "time" ) @@ -51,11 +50,7 @@ func (d *DataBases) NewGetMessageListBySeq(userID string, seqList []uint32, oper } func Map2Pb(m map[string]string) (*pbCommon.MsgData, error) { var data pbCommon.MsgData - b, err := json.Marshal(m) - if err != nil { - return nil, err - } - err = proto.Unmarshal(b, &data) + err := mapstructure.Decode(m, &data) if err != nil { return nil, err }