From e9ea117985f01573ed5e3877dc5109983bad20a1 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 17:10:45 +0800 Subject: [PATCH 01/14] tag --- pkg/common/db/mongoModel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index c07d81772..863c1b6fb 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -560,7 +560,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) if err != nil { return tagSendLogs, err } - err = cursor.All(ctx, tagSendLogs) + err = cursor.All(ctx, &tagSendLogs) if err != nil { return tagSendLogs, err } From af99a93536ee92f27c89ff67a9ae721dff346df5 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 17:12:36 +0800 Subject: [PATCH 02/14] tag --- internal/rpc/office/office.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 6061d5453..b8ac7c558 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -178,9 +178,10 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - if err := utils.CopyStructFields(resp.TagSendLogs, tagSendLogs); err != nil { + if err := utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } From a0e6a78496f7250536ab8f06c7fcbf00e8c79a2b Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 17:18:03 +0800 Subject: [PATCH 03/14] tag --- internal/rpc/office/office.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index b8ac7c558..54d2154ef 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -181,6 +181,16 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen if err := utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } + for _, sendLog := range tagSendLogs { + resp.TagSendLogs = append(resp.TagSendLogs, &pbOffice.TagSendLog{ + TagID: sendLog.SendID, + TagName: sendLog.TagName, + ContentType: sendLog.ContentType, + Content: sendLog.Content, + SendTime: sendLog.SendTime, + UserList: sendLog.UserList, + }) + } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil From 5e78697a6991b7d13e921bfa23a1f70a8e198238 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 17:22:18 +0800 Subject: [PATCH 04/14] tag --- internal/rpc/office/office.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 54d2154ef..b8ac7c558 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -181,16 +181,6 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen if err := utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs); err != nil { log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) } - for _, sendLog := range tagSendLogs { - resp.TagSendLogs = append(resp.TagSendLogs, &pbOffice.TagSendLog{ - TagID: sendLog.SendID, - TagName: sendLog.TagName, - ContentType: sendLog.ContentType, - Content: sendLog.Content, - SendTime: sendLog.SendTime, - UserList: sendLog.UserList, - }) - } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil From 7827749453861de1249f89801bddcbcbcc038aee Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 28 Mar 2022 17:37:30 +0800 Subject: [PATCH 05/14] tag notification --- pkg/common/constant/constant.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 0def0881b..586093e5d 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -125,12 +125,14 @@ const ( ReceiveNotNotifyMessage = 2 //OptionsKey - IsHistory = "history" - IsPersistent = "persistent" - IsOfflinePush = "offlinePush" - IsUnreadCount = "unreadCount" - IsConversationUpdate = "conversationUpdate" - IsSenderSync = "senderSync" + IsHistory = "history" + IsPersistent = "persistent" + IsOfflinePush = "offlinePush" + IsUnreadCount = "unreadCount" + IsConversationUpdate = "conversationUpdate" + IsSenderSync = "senderSync" + IsNotPrivate = "notPrivate" + IsSenderConversationUpdate = "senderConversationUpdate" //GroupStatus GroupOk = 0 From c4d80b4844d5efb87d15697d9bdc8e0167923933 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 28 Mar 2022 17:52:40 +0800 Subject: [PATCH 06/14] auto migrate test --- pkg/common/db/model_struct.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/common/db/model_struct.go b/pkg/common/db/model_struct.go index e9e5454cd..72396e9a1 100644 --- a/pkg/common/db/model_struct.go +++ b/pkg/common/db/model_struct.go @@ -108,6 +108,7 @@ type GroupMember struct { JoinTime time.Time `gorm:"column:join_time"` JoinSource int32 `gorm:"column:join_source"` OperatorUserID string `gorm:"column:operator_user_id;size:64"` + MuteEndTime time.Time `gorm:"column:mute_end_time"` Ex string `gorm:"column:ex;size:1024"` } @@ -220,4 +221,4 @@ type Conversation struct { func (Conversation) TableName() string { return "conversations" -} \ No newline at end of file +} From 169665da32b77db074ec0de0a25c3df95665b68d Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 18:13:01 +0800 Subject: [PATCH 07/14] tag --- internal/rpc/msg/tag_notification.go | 20 ---- internal/rpc/msg/tag_send_msg.go | 39 +++++++ internal/rpc/office/office.go | 23 +++- pkg/common/db/mongoModel.go | 35 ++++-- pkg/proto/office/office.pb.go | 156 +++++++++++++-------------- pkg/proto/office/office.proto | 2 +- 6 files changed, 162 insertions(+), 113 deletions(-) delete mode 100644 internal/rpc/msg/tag_notification.go create mode 100644 internal/rpc/msg/tag_send_msg.go diff --git a/internal/rpc/msg/tag_notification.go b/internal/rpc/msg/tag_notification.go deleted file mode 100644 index 8a6356bb4..000000000 --- a/internal/rpc/msg/tag_notification.go +++ /dev/null @@ -1,20 +0,0 @@ -package msg - -import ( - "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/log" - "Open_IM/pkg/utils" -) - -func SetTagNotification(operationID, sendID, recvID, content string, contentType int32) { - log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content, contentType) - var n NotificationMsg - n.SendID = sendID - n.RecvID = recvID - n.ContentType = contentType - n.SessionType = constant.SingleChatType - n.MsgFrom = constant.UserMsgType - n.OperationID = operationID - n.Content = []byte(content) - Notification(&n) -} diff --git a/internal/rpc/msg/tag_send_msg.go b/internal/rpc/msg/tag_send_msg.go new file mode 100644 index 000000000..08c88bfba --- /dev/null +++ b/internal/rpc/msg/tag_send_msg.go @@ -0,0 +1,39 @@ +package msg + +import ( + "Open_IM/pkg/common/config" + "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/log" + "Open_IM/pkg/grpc-etcdv3/getcdv3" + pbChat "Open_IM/pkg/proto/chat" + pbCommon "Open_IM/pkg/proto/sdk_ws" + "Open_IM/pkg/utils" + "context" + "strings" +) + +func TagSendMessage(operationID, sendID, recvID, content string, contentType int32) { + log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content, contentType) + var req pbChat.SendMsgReq + var msgData pbCommon.MsgData + msgData.SendID = sendID + msgData.RecvID = recvID + msgData.ContentType = contentType + msgData.SessionType = constant.SingleChatType + msgData.MsgFrom = constant.UserMsgType + msgData.Content = []byte(content) + msgData.Options = map[string]bool{} + msgData.Options[constant.IsSenderConversationUpdate] = false + req.MsgData = &msgData + req.OperationID = operationID + etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) + client := pbChat.NewChatClient(etcdConn) + respPb, err := client.SendMsg(context.Background(), &req) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "send msg failed", err.Error()) + return + } + if respPb.ErrCode != 0 { + log.NewError(operationID, utils.GetSelfFuncName(), "send tag msg failed ", respPb) + } +} diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index b8ac7c558..ab66f74d4 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -78,7 +78,7 @@ func (s *officeServer) GetUserTags(_ context.Context, req *pbOffice.GetUserTagsR resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "tags: ", tags) + log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "tags: ", tags) for _, v := range tags { tag := &pbOffice.Tag{ TagID: v.TagID, @@ -149,7 +149,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR resp = &pbOffice.SendMsg2TagResp{CommonResp: &pbOffice.CommonResp{}} userIDList, err := db.DB.GetUserIDListByTagID(req.SendID, req.TagID) for _, userID := range userIDList { - msg.SetTagNotification(req.OperationID, req.SendID, userID, req.Content, req.ContentType) + msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.ContentType) } if err := db.DB.SaveTagSendLog(req); err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "SaveTagSendLog failed", err.Error()) @@ -178,10 +178,23 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - if err := utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs); err != nil { - log.NewDebug(req.OperationID, utils.GetSelfFuncName(), "CopyStructFields failed", err.Error()) + for _, v := range tagSendLogs { + var userList []*pbOffice.TagUser + for _, v2 := range v.TagUserList { + userList = append(userList, &pbOffice.TagUser{ + UserID: v2.UserID, + UserName: v2.UserName, + }) + } + resp.TagSendLogs = append(resp.TagSendLogs, &pbOffice.TagSendLog{ + TagID: v.TagID, + TagName: v.TagName, + ContentType: v.ContentType, + Content: v.Content, + SendTime: v.SendTime, + TagUserList: userList, + }) } - log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 863c1b6fb..1a262f823 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -3,6 +3,7 @@ package db import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" + "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" officePb "Open_IM/pkg/proto/office" @@ -520,15 +521,20 @@ func (d *DataBases) GetUserIDListByTagID(userID, tagID string) ([]string, error) return tag.UserList, nil } +type TagUser struct { + UserID string `bson:"userID"` + UserName string `bson:"userName"` +} + type TagSendLog struct { - TagID string `bson:"tagID"` - TagName string `bson:"tagName"` - SendID string `bson:"sendID"` - SenderPlatformID int32 `bson:"senderPlatformID"` - Content string `bson:"content"` - ContentType int32 `bson:"contentType"` - SendTime int64 `bson:"sendTime"` - UserList []string `bson:"userList"` + TagID string `bson:"tagID"` + TagName string `bson:"tagName"` + SendID string `bson:"sendID"` + SenderPlatformID int32 `bson:"senderPlatformID"` + Content string `bson:"content"` + ContentType int32 `bson:"contentType"` + SendTime int64 `bson:"sendTime"` + TagUserList []TagUser `bson:"userList"` } func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error { @@ -545,7 +551,18 @@ func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error { Content: sendReq.Content, ContentType: sendReq.ContentType, SendTime: time.Now().Unix(), - UserList: tag.UserList, + } + for _, userID := range tag.UserList { + userName, err := im_mysql_model.GetUserNameByUserID(userID) + if err != nil { + log.NewError("", utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error()) + continue + } + tagUser := TagUser{ + UserID: userID, + UserName: userName, + } + tagSendLog.TagUserList = append(tagSendLog.TagUserList, tagUser) } _, err := c.InsertOne(ctx, tagSendLog) return err diff --git a/pkg/proto/office/office.pb.go b/pkg/proto/office/office.pb.go index 6f1ae7157..a3d7c9da0 100644 --- a/pkg/proto/office/office.pb.go +++ b/pkg/proto/office/office.pb.go @@ -36,7 +36,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} } func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (*CommonResp) ProtoMessage() {} func (*CommonResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{0} + return fileDescriptor_office_fb25433b0aa4afaa, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -82,7 +82,7 @@ func (m *TagUser) Reset() { *m = TagUser{} } func (m *TagUser) String() string { return proto.CompactTextString(m) } func (*TagUser) ProtoMessage() {} func (*TagUser) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{1} + return fileDescriptor_office_fb25433b0aa4afaa, []int{1} } func (m *TagUser) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TagUser.Unmarshal(m, b) @@ -129,7 +129,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{2} + return fileDescriptor_office_fb25433b0aa4afaa, []int{2} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -182,7 +182,7 @@ func (m *GetUserTagsReq) Reset() { *m = GetUserTagsReq{} } func (m *GetUserTagsReq) String() string { return proto.CompactTextString(m) } func (*GetUserTagsReq) ProtoMessage() {} func (*GetUserTagsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{3} + return fileDescriptor_office_fb25433b0aa4afaa, []int{3} } func (m *GetUserTagsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserTagsReq.Unmarshal(m, b) @@ -228,7 +228,7 @@ func (m *GetUserTagsResp) Reset() { *m = GetUserTagsResp{} } func (m *GetUserTagsResp) String() string { return proto.CompactTextString(m) } func (*GetUserTagsResp) ProtoMessage() {} func (*GetUserTagsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{4} + return fileDescriptor_office_fb25433b0aa4afaa, []int{4} } func (m *GetUserTagsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserTagsResp.Unmarshal(m, b) @@ -276,7 +276,7 @@ func (m *CreateTagReq) Reset() { *m = CreateTagReq{} } func (m *CreateTagReq) String() string { return proto.CompactTextString(m) } func (*CreateTagReq) ProtoMessage() {} func (*CreateTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{5} + return fileDescriptor_office_fb25433b0aa4afaa, []int{5} } func (m *CreateTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateTagReq.Unmarshal(m, b) @@ -335,7 +335,7 @@ func (m *CreateTagResp) Reset() { *m = CreateTagResp{} } func (m *CreateTagResp) String() string { return proto.CompactTextString(m) } func (*CreateTagResp) ProtoMessage() {} func (*CreateTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{6} + return fileDescriptor_office_fb25433b0aa4afaa, []int{6} } func (m *CreateTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateTagResp.Unmarshal(m, b) @@ -375,7 +375,7 @@ func (m *DeleteTagReq) Reset() { *m = DeleteTagReq{} } func (m *DeleteTagReq) String() string { return proto.CompactTextString(m) } func (*DeleteTagReq) ProtoMessage() {} func (*DeleteTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{7} + return fileDescriptor_office_fb25433b0aa4afaa, []int{7} } func (m *DeleteTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteTagReq.Unmarshal(m, b) @@ -427,7 +427,7 @@ func (m *DeleteTagResp) Reset() { *m = DeleteTagResp{} } func (m *DeleteTagResp) String() string { return proto.CompactTextString(m) } func (*DeleteTagResp) ProtoMessage() {} func (*DeleteTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{8} + return fileDescriptor_office_fb25433b0aa4afaa, []int{8} } func (m *DeleteTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteTagResp.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *SetTagReq) Reset() { *m = SetTagReq{} } func (m *SetTagReq) String() string { return proto.CompactTextString(m) } func (*SetTagReq) ProtoMessage() {} func (*SetTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{9} + return fileDescriptor_office_fb25433b0aa4afaa, []int{9} } func (m *SetTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetTagReq.Unmarshal(m, b) @@ -543,7 +543,7 @@ func (m *SetTagResp) Reset() { *m = SetTagResp{} } func (m *SetTagResp) String() string { return proto.CompactTextString(m) } func (*SetTagResp) ProtoMessage() {} func (*SetTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{10} + return fileDescriptor_office_fb25433b0aa4afaa, []int{10} } func (m *SetTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetTagResp.Unmarshal(m, b) @@ -586,7 +586,7 @@ func (m *SendMsg2TagReq) Reset() { *m = SendMsg2TagReq{} } func (m *SendMsg2TagReq) String() string { return proto.CompactTextString(m) } func (*SendMsg2TagReq) ProtoMessage() {} func (*SendMsg2TagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{11} + return fileDescriptor_office_fb25433b0aa4afaa, []int{11} } func (m *SendMsg2TagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagReq.Unmarshal(m, b) @@ -659,7 +659,7 @@ func (m *SendMsg2TagResp) Reset() { *m = SendMsg2TagResp{} } func (m *SendMsg2TagResp) String() string { return proto.CompactTextString(m) } func (*SendMsg2TagResp) ProtoMessage() {} func (*SendMsg2TagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{12} + return fileDescriptor_office_fb25433b0aa4afaa, []int{12} } func (m *SendMsg2TagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagResp.Unmarshal(m, b) @@ -699,7 +699,7 @@ func (m *GetTagSendLogsReq) Reset() { *m = GetTagSendLogsReq{} } func (m *GetTagSendLogsReq) String() string { return proto.CompactTextString(m) } func (*GetTagSendLogsReq) ProtoMessage() {} func (*GetTagSendLogsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{13} + return fileDescriptor_office_fb25433b0aa4afaa, []int{13} } func (m *GetTagSendLogsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsReq.Unmarshal(m, b) @@ -741,22 +741,22 @@ func (m *GetTagSendLogsReq) GetOperationID() string { } type TagSendLog struct { - TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"` - TagName string `protobuf:"bytes,2,opt,name=tagName" json:"tagName,omitempty"` - ContentType int32 `protobuf:"varint,3,opt,name=contentType" json:"contentType,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"` - SendTime int64 `protobuf:"varint,5,opt,name=sendTime" json:"sendTime,omitempty"` - UserList []string `protobuf:"bytes,6,rep,name=userList" json:"userList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"` + TagName string `protobuf:"bytes,2,opt,name=tagName" json:"tagName,omitempty"` + ContentType int32 `protobuf:"varint,3,opt,name=contentType" json:"contentType,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"` + SendTime int64 `protobuf:"varint,5,opt,name=sendTime" json:"sendTime,omitempty"` + TagUserList []*TagUser `protobuf:"bytes,6,rep,name=TagUserList" json:"TagUserList,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *TagSendLog) Reset() { *m = TagSendLog{} } func (m *TagSendLog) String() string { return proto.CompactTextString(m) } func (*TagSendLog) ProtoMessage() {} func (*TagSendLog) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{14} + return fileDescriptor_office_fb25433b0aa4afaa, []int{14} } func (m *TagSendLog) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TagSendLog.Unmarshal(m, b) @@ -811,9 +811,9 @@ func (m *TagSendLog) GetSendTime() int64 { return 0 } -func (m *TagSendLog) GetUserList() []string { +func (m *TagSendLog) GetTagUserList() []*TagUser { if m != nil { - return m.UserList + return m.TagUserList } return nil } @@ -831,7 +831,7 @@ func (m *GetTagSendLogsResp) Reset() { *m = GetTagSendLogsResp{} } func (m *GetTagSendLogsResp) String() string { return proto.CompactTextString(m) } func (*GetTagSendLogsResp) ProtoMessage() {} func (*GetTagSendLogsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_4149f396a2012e50, []int{15} + return fileDescriptor_office_fb25433b0aa4afaa, []int{15} } func (m *GetTagSendLogsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsResp.Unmarshal(m, b) @@ -1128,56 +1128,56 @@ var _OfficeService_serviceDesc = grpc.ServiceDesc{ Metadata: "office/office.proto", } -func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_4149f396a2012e50) } +func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_fb25433b0aa4afaa) } -var fileDescriptor_office_4149f396a2012e50 = []byte{ - // 762 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0x96, 0x93, 0x26, 0x6d, 0x26, 0x6d, 0xf3, 0x77, 0xff, 0x52, 0x82, 0x0f, 0x10, 0x2c, 0x90, - 0x2a, 0x90, 0x12, 0x29, 0x70, 0x40, 0x42, 0x54, 0x88, 0xa4, 0xaa, 0x8a, 0x5a, 0x5a, 0x6d, 0xd3, - 0x0b, 0x07, 0xa2, 0x6d, 0x32, 0xb1, 0xac, 0x36, 0xb6, 0xbb, 0xbb, 0x6d, 0xc5, 0x95, 0x57, 0xe0, - 0x45, 0x78, 0x09, 0x24, 0xae, 0x3c, 0x10, 0x12, 0xf2, 0x7a, 0x6d, 0xaf, 0x9d, 0x44, 0x40, 0x4e, - 0xd9, 0x99, 0x9d, 0x99, 0x7c, 0xdf, 0x37, 0xbb, 0xb3, 0x86, 0xff, 0x83, 0xc9, 0xc4, 0x1b, 0x61, - 0x27, 0xfe, 0x69, 0x87, 0x3c, 0x90, 0x01, 0xa9, 0xc6, 0x96, 0xfd, 0xf8, 0x24, 0x44, 0x7f, 0x78, - 0x78, 0xdc, 0x09, 0x2f, 0xdd, 0x8e, 0xda, 0xea, 0x88, 0xf1, 0xe5, 0xf0, 0x4e, 0x74, 0xee, 0x44, - 0x1c, 0xea, 0xec, 0x01, 0xf4, 0x82, 0xe9, 0x34, 0xf0, 0x29, 0x8a, 0x90, 0x34, 0x61, 0x15, 0x39, - 0xef, 0x05, 0x63, 0x6c, 0x5a, 0x2d, 0x6b, 0xb7, 0x42, 0x13, 0x93, 0xec, 0x40, 0x15, 0x39, 0x3f, - 0x16, 0x6e, 0xb3, 0xd4, 0xb2, 0x76, 0x6b, 0x54, 0x5b, 0xce, 0x1b, 0x58, 0x1d, 0x30, 0xf7, 0x5c, - 0x20, 0x8f, 0x42, 0x6e, 0x04, 0xf2, 0xc3, 0xbe, 0xca, 0xad, 0x51, 0x6d, 0x11, 0x1b, 0xd6, 0xa2, - 0xd5, 0x07, 0x36, 0x45, 0x9d, 0x9c, 0xda, 0xce, 0x05, 0x94, 0x07, 0xcc, 0x25, 0xdb, 0x50, 0x91, - 0xcc, 0x4d, 0x33, 0x63, 0x23, 0x42, 0x23, 0x99, 0x6b, 0xe4, 0x25, 0x26, 0x79, 0x1e, 0x97, 0x3c, - 0xf2, 0x84, 0x6c, 0x96, 0x5b, 0xe5, 0xdd, 0x7a, 0xb7, 0xd1, 0xd6, 0x0a, 0x68, 0x34, 0x34, 0x0d, - 0x70, 0xde, 0xc3, 0xe6, 0x01, 0xca, 0xc8, 0x39, 0x60, 0xae, 0xa0, 0x78, 0xbd, 0x10, 0x69, 0x0b, - 0xea, 0x41, 0x88, 0x9c, 0x49, 0x2f, 0xf0, 0x0f, 0xfb, 0xfa, 0x4f, 0x4d, 0x97, 0x33, 0x81, 0x46, - 0xae, 0x96, 0x08, 0x49, 0x17, 0x60, 0x94, 0x2a, 0xa8, 0x0a, 0xd6, 0xbb, 0x24, 0x41, 0x93, 0x69, - 0x4b, 0x8d, 0x28, 0xf2, 0x08, 0x56, 0x24, 0x73, 0x45, 0xb3, 0xa4, 0xb0, 0xd7, 0x0d, 0xec, 0x54, - 0x6d, 0x38, 0x5f, 0x2c, 0x58, 0xef, 0x71, 0x64, 0x12, 0x23, 0x1f, 0x5e, 0x9b, 0x5a, 0x58, 0x79, - 0x2d, 0x32, 0x32, 0xa5, 0x1c, 0x99, 0x87, 0x00, 0xf1, 0x2a, 0x55, 0xa9, 0x46, 0x0d, 0x4f, 0x91, - 0xec, 0xca, 0x2c, 0xd9, 0x1e, 0x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e, 0x19, 0xc9, 0xfc, 0xb4, 0xc8, 0x48, 0x16, 0xef, 0xde, 0x81, 0x7a, 0x92, 0x8d, 0xee, - 0x93, 0x07, 0x86, 0x1e, 0xf9, 0xeb, 0x65, 0xdb, 0x8b, 0xb6, 0x44, 0xf8, 0x6e, 0xeb, 0x63, 0xa3, - 0xad, 0xbf, 0x7d, 0x5e, 0xc7, 0x3f, 0x17, 0x55, 0xf5, 0x61, 0xf3, 0xe2, 0x77, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x62, 0x7d, 0x95, 0x4e, 0x1a, 0x09, 0x00, 0x00, +var fileDescriptor_office_fb25433b0aa4afaa = []byte{ + // 764 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x6f, 0xd3, 0x4a, + 0x10, 0x96, 0x93, 0x26, 0x6d, 0x26, 0x6d, 0xf3, 0xba, 0xaf, 0xaf, 0x2f, 0xf8, 0x00, 0xc1, 0x02, + 0xa9, 0x02, 0x29, 0x11, 0x81, 0x03, 0x12, 0xa2, 0x42, 0x24, 0x55, 0x55, 0xd4, 0xd2, 0x6a, 0x9b, + 0x5e, 0x38, 0x10, 0x6d, 0x93, 0x89, 0x65, 0xb5, 0xb1, 0xdd, 0xdd, 0x6d, 0x2b, 0xae, 0xfc, 0x05, + 0x7e, 0x13, 0x82, 0x2b, 0x3f, 0x08, 0x09, 0x79, 0xbd, 0xb6, 0xd7, 0x89, 0x23, 0x20, 0xa7, 0xec, + 0xcc, 0xce, 0x4c, 0xbe, 0xef, 0x9b, 0xdd, 0x59, 0xc3, 0xbf, 0xc1, 0x64, 0xe2, 0x8d, 0xb0, 0x13, + 0xff, 0xb4, 0x43, 0x1e, 0xc8, 0x80, 0x54, 0x63, 0xcb, 0x7e, 0x78, 0x12, 0xa2, 0x3f, 0x3c, 0x3c, + 0xee, 0x84, 0x97, 0x6e, 0x47, 0x6d, 0x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, 0xb2, 0x9d, 0x72, 0x37, 0x9e, + 0x08, 0xfb, 0xbf, 0x02, 0x6f, 0x9c, 0x99, 0x0e, 0xc8, 0x2c, 0xd3, 0x9c, 0xc9, 0x59, 0x66, 0x7e, + 0x92, 0x76, 0xa0, 0x1a, 0x4f, 0x10, 0xb2, 0x95, 0x04, 0xa4, 0x43, 0xd2, 0x26, 0xb3, 0x2e, 0x11, + 0x46, 0x24, 0x8d, 0x5b, 0x96, 0x91, 0xcc, 0x0f, 0x91, 0x8c, 0xe4, 0xec, 0x95, 0x3c, 0x50, 0x2f, + 0xb5, 0xd1, 0x7d, 0x72, 0xcf, 0xd0, 0x23, 0x7f, 0xeb, 0x6c, 0x7b, 0xd1, 0x96, 0x08, 0xdf, 0x6e, + 0x7d, 0x68, 0xb4, 0xf5, 0x27, 0xd1, 0xab, 0xf8, 0xe7, 0xa2, 0xaa, 0xbe, 0x77, 0x9e, 0xff, 0x0a, + 0x00, 0x00, 0xff, 0xff, 0xee, 0x5a, 0x78, 0x47, 0x31, 0x09, 0x00, 0x00, } diff --git a/pkg/proto/office/office.proto b/pkg/proto/office/office.proto index 0e675a25a..6003d6306 100644 --- a/pkg/proto/office/office.proto +++ b/pkg/proto/office/office.proto @@ -88,7 +88,7 @@ message TagSendLog { int32 contentType = 3; string content = 4; int64 sendTime = 5; - repeated string userList = 6; + repeated TagUser TagUserList = 6; } message GetTagSendLogsResp { From 6c45665fde6e941b178825e472b105c30407e515 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Mon, 28 Mar 2022 18:30:12 +0800 Subject: [PATCH 08/14] add tag message conversation update --- internal/msg_gateway/gate/validate.go | 1 + internal/rpc/msg/send_msg.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/internal/msg_gateway/gate/validate.go b/internal/msg_gateway/gate/validate.go index ea6891a33..378cbf1a7 100644 --- a/internal/msg_gateway/gate/validate.go +++ b/internal/msg_gateway/gate/validate.go @@ -134,6 +134,7 @@ func (ws *WServer) signalMessageAssemble(s *open_im_sdk.SignalReq, operationID s utils.SetSwitchFromOptions(options, constant.IsPersistent, false) utils.SetSwitchFromOptions(options, constant.IsSenderSync, true) utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(options, constant.IsSenderConversationUpdate, false) utils.SetSwitchFromOptions(options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(options, constant.IsOfflinePush, true) msg.Options = options diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 0e2d45192..2820bd8ad 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -116,6 +116,7 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { case constant.HasReadReceipt: log.Info("", "this is a test start", msg, msg.Options) utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) log.Info("", "this is a test end", msg, msg.Options) @@ -124,6 +125,7 @@ func (rpc *rpcChat) encapsulateMsgData(msg *sdk_ws.MsgData) { utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) utils.SetSwitchFromOptions(msg.Options, constant.IsSenderSync, false) utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) utils.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false) utils.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false) @@ -517,8 +519,10 @@ func Notification(n *NotificationMsg) { utils.SetSwitchFromOptions(msg.Options, constant.IsHistory, false) utils.SetSwitchFromOptions(msg.Options, constant.IsPersistent, false) utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) case constant.ReliableNotificationNoMsg: utils.SetSwitchFromOptions(msg.Options, constant.IsConversationUpdate, false) + utils.SetSwitchFromOptions(msg.Options, constant.IsSenderConversationUpdate, false) case constant.ReliableNotificationMsg: } From e95400988e4a6bfca0b56e098a7b915614ff186c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 18:51:48 +0800 Subject: [PATCH 09/14] tag --- internal/rpc/office/office.go | 18 +--- pkg/common/db/mongoModel.go | 28 ++---- pkg/proto/office/office.pb.go | 157 ++++++++++++++++------------------ pkg/proto/office/office.proto | 1 - 4 files changed, 82 insertions(+), 122 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index ab66f74d4..e180fb56d 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -178,23 +178,7 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - for _, v := range tagSendLogs { - var userList []*pbOffice.TagUser - for _, v2 := range v.TagUserList { - userList = append(userList, &pbOffice.TagUser{ - UserID: v2.UserID, - UserName: v2.UserName, - }) - } - resp.TagSendLogs = append(resp.TagSendLogs, &pbOffice.TagSendLog{ - TagID: v.TagID, - TagName: v.TagName, - ContentType: v.ContentType, - Content: v.Content, - SendTime: v.SendTime, - TagUserList: userList, - }) - } + utils.CopyStructFields(resp.TagSendLogs, tagSendLogs) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 1a262f823..383b6fc33 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -3,7 +3,6 @@ package db import ( "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" - "Open_IM/pkg/common/db/mysql_model/im_mysql_model" "Open_IM/pkg/common/log" pbMsg "Open_IM/pkg/proto/chat" officePb "Open_IM/pkg/proto/office" @@ -527,14 +526,13 @@ type TagUser struct { } type TagSendLog struct { - TagID string `bson:"tagID"` - TagName string `bson:"tagName"` - SendID string `bson:"sendID"` - SenderPlatformID int32 `bson:"senderPlatformID"` - Content string `bson:"content"` - ContentType int32 `bson:"contentType"` - SendTime int64 `bson:"sendTime"` - TagUserList []TagUser `bson:"userList"` + TagID string `bson:"tagID"` + TagName string `bson:"tagName"` + SendID string `bson:"sendID"` + SenderPlatformID int32 `bson:"senderPlatformID"` + Content string `bson:"content"` + ContentType int32 `bson:"contentType"` + SendTime int64 `bson:"sendTime"` } func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error { @@ -552,18 +550,6 @@ func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error { ContentType: sendReq.ContentType, SendTime: time.Now().Unix(), } - for _, userID := range tag.UserList { - userName, err := im_mysql_model.GetUserNameByUserID(userID) - if err != nil { - log.NewError("", utils.GetSelfFuncName(), "GetUserNameByUserID failed", err.Error()) - continue - } - tagUser := TagUser{ - UserID: userID, - UserName: userName, - } - tagSendLog.TagUserList = append(tagSendLog.TagUserList, tagUser) - } _, err := c.InsertOne(ctx, tagSendLog) return err } diff --git a/pkg/proto/office/office.pb.go b/pkg/proto/office/office.pb.go index a3d7c9da0..b7ee98a38 100644 --- a/pkg/proto/office/office.pb.go +++ b/pkg/proto/office/office.pb.go @@ -36,7 +36,7 @@ func (m *CommonResp) Reset() { *m = CommonResp{} } func (m *CommonResp) String() string { return proto.CompactTextString(m) } func (*CommonResp) ProtoMessage() {} func (*CommonResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{0} + return fileDescriptor_office_8580c3f7b2871da9, []int{0} } func (m *CommonResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CommonResp.Unmarshal(m, b) @@ -82,7 +82,7 @@ func (m *TagUser) Reset() { *m = TagUser{} } func (m *TagUser) String() string { return proto.CompactTextString(m) } func (*TagUser) ProtoMessage() {} func (*TagUser) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{1} + return fileDescriptor_office_8580c3f7b2871da9, []int{1} } func (m *TagUser) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TagUser.Unmarshal(m, b) @@ -129,7 +129,7 @@ func (m *Tag) Reset() { *m = Tag{} } func (m *Tag) String() string { return proto.CompactTextString(m) } func (*Tag) ProtoMessage() {} func (*Tag) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{2} + return fileDescriptor_office_8580c3f7b2871da9, []int{2} } func (m *Tag) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Tag.Unmarshal(m, b) @@ -182,7 +182,7 @@ func (m *GetUserTagsReq) Reset() { *m = GetUserTagsReq{} } func (m *GetUserTagsReq) String() string { return proto.CompactTextString(m) } func (*GetUserTagsReq) ProtoMessage() {} func (*GetUserTagsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{3} + return fileDescriptor_office_8580c3f7b2871da9, []int{3} } func (m *GetUserTagsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserTagsReq.Unmarshal(m, b) @@ -228,7 +228,7 @@ func (m *GetUserTagsResp) Reset() { *m = GetUserTagsResp{} } func (m *GetUserTagsResp) String() string { return proto.CompactTextString(m) } func (*GetUserTagsResp) ProtoMessage() {} func (*GetUserTagsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{4} + return fileDescriptor_office_8580c3f7b2871da9, []int{4} } func (m *GetUserTagsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetUserTagsResp.Unmarshal(m, b) @@ -276,7 +276,7 @@ func (m *CreateTagReq) Reset() { *m = CreateTagReq{} } func (m *CreateTagReq) String() string { return proto.CompactTextString(m) } func (*CreateTagReq) ProtoMessage() {} func (*CreateTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{5} + return fileDescriptor_office_8580c3f7b2871da9, []int{5} } func (m *CreateTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateTagReq.Unmarshal(m, b) @@ -335,7 +335,7 @@ func (m *CreateTagResp) Reset() { *m = CreateTagResp{} } func (m *CreateTagResp) String() string { return proto.CompactTextString(m) } func (*CreateTagResp) ProtoMessage() {} func (*CreateTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{6} + return fileDescriptor_office_8580c3f7b2871da9, []int{6} } func (m *CreateTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_CreateTagResp.Unmarshal(m, b) @@ -375,7 +375,7 @@ func (m *DeleteTagReq) Reset() { *m = DeleteTagReq{} } func (m *DeleteTagReq) String() string { return proto.CompactTextString(m) } func (*DeleteTagReq) ProtoMessage() {} func (*DeleteTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{7} + return fileDescriptor_office_8580c3f7b2871da9, []int{7} } func (m *DeleteTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteTagReq.Unmarshal(m, b) @@ -427,7 +427,7 @@ func (m *DeleteTagResp) Reset() { *m = DeleteTagResp{} } func (m *DeleteTagResp) String() string { return proto.CompactTextString(m) } func (*DeleteTagResp) ProtoMessage() {} func (*DeleteTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{8} + return fileDescriptor_office_8580c3f7b2871da9, []int{8} } func (m *DeleteTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_DeleteTagResp.Unmarshal(m, b) @@ -470,7 +470,7 @@ func (m *SetTagReq) Reset() { *m = SetTagReq{} } func (m *SetTagReq) String() string { return proto.CompactTextString(m) } func (*SetTagReq) ProtoMessage() {} func (*SetTagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{9} + return fileDescriptor_office_8580c3f7b2871da9, []int{9} } func (m *SetTagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetTagReq.Unmarshal(m, b) @@ -543,7 +543,7 @@ func (m *SetTagResp) Reset() { *m = SetTagResp{} } func (m *SetTagResp) String() string { return proto.CompactTextString(m) } func (*SetTagResp) ProtoMessage() {} func (*SetTagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{10} + return fileDescriptor_office_8580c3f7b2871da9, []int{10} } func (m *SetTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetTagResp.Unmarshal(m, b) @@ -586,7 +586,7 @@ func (m *SendMsg2TagReq) Reset() { *m = SendMsg2TagReq{} } func (m *SendMsg2TagReq) String() string { return proto.CompactTextString(m) } func (*SendMsg2TagReq) ProtoMessage() {} func (*SendMsg2TagReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{11} + return fileDescriptor_office_8580c3f7b2871da9, []int{11} } func (m *SendMsg2TagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagReq.Unmarshal(m, b) @@ -659,7 +659,7 @@ func (m *SendMsg2TagResp) Reset() { *m = SendMsg2TagResp{} } func (m *SendMsg2TagResp) String() string { return proto.CompactTextString(m) } func (*SendMsg2TagResp) ProtoMessage() {} func (*SendMsg2TagResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{12} + return fileDescriptor_office_8580c3f7b2871da9, []int{12} } func (m *SendMsg2TagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagResp.Unmarshal(m, b) @@ -699,7 +699,7 @@ func (m *GetTagSendLogsReq) Reset() { *m = GetTagSendLogsReq{} } func (m *GetTagSendLogsReq) String() string { return proto.CompactTextString(m) } func (*GetTagSendLogsReq) ProtoMessage() {} func (*GetTagSendLogsReq) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{13} + return fileDescriptor_office_8580c3f7b2871da9, []int{13} } func (m *GetTagSendLogsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsReq.Unmarshal(m, b) @@ -741,22 +741,21 @@ func (m *GetTagSendLogsReq) GetOperationID() string { } type TagSendLog struct { - TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"` - TagName string `protobuf:"bytes,2,opt,name=tagName" json:"tagName,omitempty"` - ContentType int32 `protobuf:"varint,3,opt,name=contentType" json:"contentType,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"` - SendTime int64 `protobuf:"varint,5,opt,name=sendTime" json:"sendTime,omitempty"` - TagUserList []*TagUser `protobuf:"bytes,6,rep,name=TagUserList" json:"TagUserList,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"` + TagName string `protobuf:"bytes,2,opt,name=tagName" json:"tagName,omitempty"` + ContentType int32 `protobuf:"varint,3,opt,name=contentType" json:"contentType,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"` + SendTime int64 `protobuf:"varint,5,opt,name=sendTime" json:"sendTime,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *TagSendLog) Reset() { *m = TagSendLog{} } func (m *TagSendLog) String() string { return proto.CompactTextString(m) } func (*TagSendLog) ProtoMessage() {} func (*TagSendLog) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{14} + return fileDescriptor_office_8580c3f7b2871da9, []int{14} } func (m *TagSendLog) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TagSendLog.Unmarshal(m, b) @@ -811,13 +810,6 @@ func (m *TagSendLog) GetSendTime() int64 { return 0 } -func (m *TagSendLog) GetTagUserList() []*TagUser { - if m != nil { - return m.TagUserList - } - return nil -} - type GetTagSendLogsResp struct { CommonResp *CommonResp `protobuf:"bytes,1,opt,name=commonResp" json:"commonResp,omitempty"` Pagination *sdk_ws.ResponsePagination `protobuf:"bytes,2,opt,name=Pagination" json:"Pagination,omitempty"` @@ -831,7 +823,7 @@ func (m *GetTagSendLogsResp) Reset() { *m = GetTagSendLogsResp{} } func (m *GetTagSendLogsResp) String() string { return proto.CompactTextString(m) } func (*GetTagSendLogsResp) ProtoMessage() {} func (*GetTagSendLogsResp) Descriptor() ([]byte, []int) { - return fileDescriptor_office_fb25433b0aa4afaa, []int{15} + return fileDescriptor_office_8580c3f7b2871da9, []int{15} } func (m *GetTagSendLogsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsResp.Unmarshal(m, b) @@ -1128,56 +1120,55 @@ var _OfficeService_serviceDesc = grpc.ServiceDesc{ Metadata: "office/office.proto", } -func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_fb25433b0aa4afaa) } +func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_8580c3f7b2871da9) } -var fileDescriptor_office_fb25433b0aa4afaa = []byte{ - // 764 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0x41, 0x6f, 0xd3, 0x4a, - 0x10, 0x96, 0x93, 0x26, 0x6d, 0x26, 0x6d, 0xf3, 0xba, 0xaf, 0xaf, 0x2f, 0xf8, 0x00, 0xc1, 0x02, - 0xa9, 0x02, 0x29, 0x11, 0x81, 0x03, 0x12, 0xa2, 0x42, 0x24, 0x55, 0x55, 0xd4, 0xd2, 0x6a, 0x9b, - 0x5e, 0x38, 0x10, 0x6d, 0x93, 0x89, 0x65, 0xb5, 0xb1, 0xdd, 0xdd, 0x6d, 0x2b, 0xae, 0xfc, 0x05, - 0x7e, 0x13, 0x82, 0x2b, 0x3f, 0x08, 0x09, 0x79, 0xbd, 0xb6, 0xd7, 0x89, 0x23,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8f, 0x0d, 0x31, 0x48, 0xe8, 0x2d, 0x6a, 0x86, 0x75, 0x7f, 0x96, 0x60, 0xe3, 0x44, 0x85, 0x9c, - 0x21, 0xbf, 0xf5, 0x46, 0x48, 0xf6, 0xa0, 0x6e, 0x3c, 0x1c, 0x64, 0x27, 0xa9, 0x90, 0x7f, 0x99, - 0xec, 0xff, 0x0b, 0xfd, 0x22, 0x24, 0x2f, 0xa1, 0x96, 0xce, 0x62, 0xb2, 0x9d, 0x72, 0x37, 0x9e, - 0x08, 0xfb, 0xbf, 0x02, 0x6f, 0x9c, 0x99, 0x0e, 0xc8, 0x2c, 0xd3, 0x9c, 0xc9, 0x59, 0x66, 0x7e, - 0x92, 0x76, 0xa0, 0x1a, 0x4f, 0x10, 0xb2, 0x95, 0x04, 0xa4, 0x43, 0xd2, 0x26, 0xb3, 0x2e, 0x11, - 0x46, 0x24, 0x8d, 0x5b, 0x96, 0x91, 0xcc, 0x0f, 0x91, 0x8c, 0xe4, 0xec, 0x95, 0x3c, 0x50, 0x2f, - 0xb5, 0xd1, 0x7d, 0x72, 0xcf, 0xd0, 0x23, 0x7f, 0xeb, 0x6c, 0x7b, 0xd1, 0x96, 0x08, 0xdf, 0x6e, - 0x7d, 0x68, 0xb4, 0xf5, 0x27, 0xd1, 0xab, 0xf8, 0xe7, 0xa2, 0xaa, 0xbe, 0x77, 0x9e, 0xff, 0x0a, - 0x00, 0x00, 0xff, 0xff, 0xee, 0x5a, 0x78, 0x47, 0x31, 0x09, 0x00, 0x00, +var fileDescriptor_office_8580c3f7b2871da9 = []byte{ + // 751 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xc1, 0x6e, 0xd3, 0x4c, + 0x10, 0x96, 0x93, 0x26, 0x6d, 0x26, 0x6d, 0xf3, 0x77, 0xff, 0x52, 0x82, 0x0f, 0x10, 0x2c, 0x90, + 0x2a, 0x90, 0x12,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x62, 0x92, 0xe7, 0x71, 0xc9, 0x23, 0x4f, + 0xc8, 0x66, 0xb9, 0x55, 0xde, 0xad, 0x77, 0x1b, 0x6d, 0xad, 0x80, 0x46, 0x43, 0xd3, 0x00, 0xe7, + 0x3d, 0x6c, 0x1e, 0xa0, 0x8c, 0x9c, 0x03, 0xe6, 0x0a, 0x8a, 0xd7, 0x0b, 0x91, 0xb6, 0xa0, 0x1e, + 0x84, 0xc8, 0x99, 0xf4, 0x02, 0xff, 0xb0, 0xaf, 0xff, 0xd4, 0x74, 0x39, 0x13, 0x68, 0xe4, 0x6a, + 0x89, 0x90, 0x74, 0x01, 0x46, 0xa9, 0x82, 0xaa, 0x60, 0xbd, 0x4b, 0x12, 0x34, 0x99, 0xb6, 0xd4, + 0x88, 0x22, 0x8f, 0x60, 0x45, 0x32, 0x57, 0x34, 0x4b, 0x0a, 0x7b, 0xdd, 0xc0, 0x4e, 0xd5, 0x86, + 0xf3, 0xc5, 0x82, 0xf5, 0x1e, 0x47, 0x26, 0x31, 0xf2, 0xe1, 0xb5, 0xa9, 0x85, 0x95, 0xd7, 0x22, + 0x23, 0x53, 0xca, 0x91, 0x79, 0x08, 0x10, 0xaf, 0x52, 0x95, 0x6a, 0xd4, 0xf0, 0x14, 0xc9, 0xae, + 0xcc, 0x92, 0xed, 0xc1, 0x86, 0x81, 0x61, 0x39, 0xaa, 0xce, 0x27, 0x58, 0xef, 0xe3, 0x15, 0xa6, + 0x44, 0x16, 0x69, 0x9f, 0x1e, 0x81, 0x92, 0x79, 0x04, 0x0a, 0x20, 0xcb, 0x73, 0x41, 0x1a, 0xf5, + 0x97, 0x04, 0xf9, 0xd3, 0x82, 0xda, 0x19, 0xca, 0xa5, 0x20, 0x36, 0x61, 0xd5, 0xc7, 0x3b, 0xd5, + 0x99, 0x18, 0x5e, 0x62, 0x92, 0x36, 0x10, 0xcf, 0x1f, 0x71, 0x64, 0x02, 0xcf, 0xb3, 0x4e, 0xac, + 0xa8, 0x4e, 0xcc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40, 0x8a, 0x62, 0x2d, 0x39, 0x2f, 0xf7, 0x73, 0x0a, + 0x97, 0x54, 0xce, 0xd3, 0xb9, 0x0a, 0x8b, 0x30, 0xf0, 0x05, 0x2e, 0x90, 0xf8, 0x25, 0xd4, 0x65, + 0x86, 0x46, 0xbf, 0x1c, 0xc4, 0x98, 0xbe, 0x7a, 0x8b, 0x9a, 0x61, 0xdd, 0x5f, 0x25, 0xd8, 0x38, + 0x51, 0x21, 0x67, 0xc8, 0x6f, 0xbd, 0x11, 0x92, 0x3d, 0xa8, 0x1b, 0xaf, 0x00, 0xd9, 0x49, 0x2a, + 0xe4, 0x9f, 0x19, 0xfb, 0xfe, 0x5c, 0xbf, 0x08, 0xc9, 0x2b, 0xa8, 0xa5, 0x83, 0x95, 0x6c, 0xa7, + 0xdc, 0x8d, 0x79, 0x6f, 0xdf, 0x9b, 0xe3, 0x8d, 0x33, 0xd3, 0x69, 0x97, 0x65, 0x9a, 0x03, 0x36, + 0xcb, 0xcc, 0x8f, 0xc5, 0x0e, 0x54, 0xe3, 0x71, 0x40, 0xb6, 0x92, 0x80, 0x74, 0xe2, 0xd9, 0xa4, + 0xe8, 0x12, 0x61, 0x44, 0xd2, 0xb8, 0x32, 0x19, 0xc9, 0xfc, 0x44, 0xc8, 0x48, 0x16, 0xef, 0xd7, + 0x81, 0x7a, 0x76, 0x8d, 0xee, 0x93, 0x07, 0x86, 0x1e, 0xf9, 0x2b, 0x64, 0xdb, 0x8b, 0xb6, 0x44, + 0xf8, 0x6e, 0xeb, 0x63, 0xa3, 0xad, 0xbf, 0x6f, 0x5e, 0xc7, 0x3f, 0x17, 0x55, 0xf5, 0xf1, 0xf2, + 0xe2, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x72, 0xfc, 0x2a, 0x94, 0xfe, 0x08, 0x00, 0x00, } diff --git a/pkg/proto/office/office.proto b/pkg/proto/office/office.proto index 6003d6306..bb0a59b0a 100644 --- a/pkg/proto/office/office.proto +++ b/pkg/proto/office/office.proto @@ -88,7 +88,6 @@ message TagSendLog { int32 contentType = 3; string content = 4; int64 sendTime = 5; - repeated TagUser TagUserList = 6; } message GetTagSendLogsResp { From c67a937d40c216cceb2fa464e2d0cabef3f9809c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 18:53:57 +0800 Subject: [PATCH 10/14] tag --- internal/rpc/office/office.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index e180fb56d..8401a1c9f 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -178,7 +178,7 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - utils.CopyStructFields(resp.TagSendLogs, tagSendLogs) + utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } From a11c4fcb58181a74097086929e7fd8608f02a9f6 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 19:05:58 +0800 Subject: [PATCH 11/14] tag --- internal/rpc/office/office.go | 4 +++- pkg/common/db/mongoModel.go | 42 +++++++++++++++++------------------ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 8401a1c9f..2d0cce613 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -178,7 +178,9 @@ func (s *officeServer) GetTagSendLogs(_ context.Context, req *pbOffice.GetTagSen resp.CommonResp.ErrCode = constant.ErrDB.ErrCode return resp, nil } - utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs) + if err := utils.CopyStructFields(&resp.TagSendLogs, tagSendLogs); err != nil { + log.NewDebug(req.OperationID, utils.GetSelfFuncName(), err.Error()) + } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String()) return resp, nil } diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 383b6fc33..2f97a8a6a 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -436,17 +436,17 @@ func (d *DataBases) DelGroupMember(groupID, uid string) error { } type Tag struct { - UserID string `bson:"userID"` - TagID string `bson:"tagID"` - TagName string `bson:"tagName"` - UserList []string `bson:"userList"` + UserID string `bson:"user_id"` + TagID string `bson:"tag_id"` + TagName string `bson:"tag_name"` + UserList []string `bson:"user_list"` } func (d *DataBases) GetUserTags(userID string) ([]Tag, error) { ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag) var tags []Tag - cursor, err := c.Find(ctx, bson.M{"userID": userID}) + cursor, err := c.Find(ctx, bson.M{"user_id": userID}) if err != nil { return tags, err } @@ -473,7 +473,7 @@ func (d *DataBases) CreateTag(userID, tagName string, userList []string) error { func (d *DataBases) DeleteTag(userID, tagID string) error { ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag) - _, err := c.DeleteOne(ctx, bson.M{"userID": userID, "tagID": tagID}) + _, err := c.DeleteOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}) return err } @@ -481,11 +481,11 @@ func (d *DataBases) SetTag(userID, tagID, newName string, increaseUserIDList []s ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag) var tag Tag - if err := c.FindOne(ctx, bson.M{"tagID": tagID, "userID": userID}).Decode(&tag); err != nil { + if err := c.FindOne(ctx, bson.M{"tag_id": tagID, "user_id": userID}).Decode(&tag); err != nil { return err } if newName != "" { - _, err := c.UpdateOne(ctx, bson.M{"userID": userID, "tagID": tagID}, bson.M{"$set": bson.M{"tagName": newName}}) + _, err := c.UpdateOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}, bson.M{"$set": bson.M{"tag_name": newName}}) if err != nil { return err } @@ -505,7 +505,7 @@ func (d *DataBases) SetTag(userID, tagID, newName string, increaseUserIDList []s newUserList = append(newUserList, v) } } - _, err := c.UpdateOne(ctx, bson.M{"userID": userID, "tagID": tagID}, bson.M{"$set": bson.M{"userList": newUserList}}) + _, err := c.UpdateOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}, bson.M{"$set": bson.M{"user_list": newUserList}}) if err != nil { return err } @@ -516,30 +516,30 @@ func (d *DataBases) GetUserIDListByTagID(userID, tagID string) ([]string, error) var tag Tag ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag) - _ = c.FindOne(ctx, bson.M{"userID": userID, "tagID": tagID}).Decode(&tag) + _ = c.FindOne(ctx, bson.M{"user_id": userID, "tag_id": tagID}).Decode(&tag) return tag.UserList, nil } type TagUser struct { - UserID string `bson:"userID"` - UserName string `bson:"userName"` + UserID string `bson:"user_id"` + UserName string `bson:"user_name"` } type TagSendLog struct { - TagID string `bson:"tagID"` - TagName string `bson:"tagName"` - SendID string `bson:"sendID"` - SenderPlatformID int32 `bson:"senderPlatformID"` + TagID string `bson:"tag_id"` + TagName string `bson:"tag_name"` + SendID string `bson:"send_id"` + SenderPlatformID int32 `bson:"sender_platform_id"` Content string `bson:"content"` - ContentType int32 `bson:"contentType"` - SendTime int64 `bson:"sendTime"` + ContentType int32 `bson:"content_type"` + SendTime int64 `bson:"send_time"` } func (d *DataBases) SaveTagSendLog(sendReq *officePb.SendMsg2TagReq) error { ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cTag) var tag Tag - _ = c.FindOne(ctx, bson.M{"userID": sendReq.SendID, "tagID": sendReq.TagID}).Decode(&tag) + _ = c.FindOne(ctx, bson.M{"user_id": sendReq.SendID, "tag_id": sendReq.TagID}).Decode(&tag) c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) tagSendLog := TagSendLog{ TagID: sendReq.TagID, @@ -558,8 +558,8 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) var tagSendLogs []TagSendLog ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) - findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)) - cursor, err := c.Find(ctx, bson.M{"sendID": userID}, findOpts) + findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort("-send_time") + cursor, err := c.Find(ctx, bson.M{"send_id": userID}, findOpts) if err != nil { return tagSendLogs, err } From 5cdb039c33cf43cc1bb518681ac41d58045fe07a Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 19:12:31 +0800 Subject: [PATCH 12/14] tag --- pkg/common/db/mongoModel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 2f97a8a6a..d49d1cde3 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -558,7 +558,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) var tagSendLogs []TagSendLog ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) - findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort("-send_time") + findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort(bson.D{{"send_time", -1}}) cursor, err := c.Find(ctx, bson.M{"send_id": userID}, findOpts) if err != nil { return tagSendLogs, err From 14c5e631ff320b3747a9f92d2b5236f558185be8 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 19:15:59 +0800 Subject: [PATCH 13/14] tag --- pkg/common/db/mongoModel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index d49d1cde3..c22cc05ba 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -558,7 +558,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) var tagSendLogs []TagSendLog ctx, _ := context.WithTimeout(context.Background(), time.Duration(config.Config.Mongo.DBTimeout)*time.Second) c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) - findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort(bson.D{{"send_time", -1}}) + findOpts := options.Find().SetLimit(int64(showNumber)).SetSkip(int64(showNumber) * (int64(pageNumber) - 1)).SetSort(bson.M{"send_time": -1}) cursor, err := c.Find(ctx, bson.M{"send_id": userID}, findOpts) if err != nil { return tagSendLogs, err From 07971819678763527fa0334ffc2862b4da3dc924 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Mon, 28 Mar 2022 19:18:30 +0800 Subject: [PATCH 14/14] tag --- pkg/common/db/mongoModel.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index c22cc05ba..e503c06ab 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -26,7 +26,7 @@ import ( const cChat = "msg" const cGroup = "group" const cTag = "tag" -const cSendLog = "sendLog" +const cSendLog = "send_log" const singleGocMsgNum = 5000 type MsgInfo struct {