From 7ed6ee50754652e718ddfa3a11b31d8d13eebcd1 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 15:35:03 +0800 Subject: [PATCH 1/8] tag --- .../api/third/minio_storage_credential.go | 2 +- internal/rpc/msg/tag_send_msg.go | 10 +- internal/rpc/office/office.go | 35 +++- internal/rpc/user/user.go | 33 +++ pkg/base_info/office_struct.go | 7 +- pkg/common/db/mongoModel.go | 25 +-- .../im_mysql_model/group_member_model.go | 14 ++ .../mysql_model/im_mysql_model/user_model.go | 9 + pkg/proto/office/office.pb.go | 198 +++++++++--------- pkg/proto/office/office.proto | 19 +- 10 files changed, 226 insertions(+), 126 deletions(-) diff --git a/internal/api/third/minio_storage_credential.go b/internal/api/third/minio_storage_credential.go index 50ab64eb2..b11f04690 100644 --- a/internal/api/third/minio_storage_credential.go +++ b/internal/api/third/minio_storage_credential.go @@ -81,7 +81,7 @@ func MinioUploadFile(c *gin.Context) { _, err = minioClient.PutObject(context.Background(), config.Config.Credential.Minio.Bucket, newName, fileObj, file.Size, minio.PutObjectOptions{ContentType: newType}) if err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "open file error") - c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "invalid file path" + err.Error()}) + c.JSON(http.StatusInternalServerError, gin.H{"errCode": 500, "errMsg": "invalid file path" + err.Error()}) return } resp.NewName = newName diff --git a/internal/rpc/msg/tag_send_msg.go b/internal/rpc/msg/tag_send_msg.go index 08c88bfba..6d8c0a0b3 100644 --- a/internal/rpc/msg/tag_send_msg.go +++ b/internal/rpc/msg/tag_send_msg.go @@ -10,20 +10,24 @@ import ( "Open_IM/pkg/utils" "context" "strings" + "time" ) -func TagSendMessage(operationID, sendID, recvID, content string, contentType int32) { - log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content, contentType) +func TagSendMessage(operationID, sendID, recvID, content string, senderPlatformID int32) { + log.NewInfo(operationID, utils.GetSelfFuncName(), "args: ", sendID, recvID, content) var req pbChat.SendMsgReq var msgData pbCommon.MsgData msgData.SendID = sendID msgData.RecvID = recvID - msgData.ContentType = contentType + msgData.ContentType = constant.Custom msgData.SessionType = constant.SingleChatType msgData.MsgFrom = constant.UserMsgType msgData.Content = []byte(content) msgData.Options = map[string]bool{} msgData.Options[constant.IsSenderConversationUpdate] = false + msgData.SendTime = time.Now().Unix() + msgData.CreateTime = time.Now().Unix() + msgData.SenderPlatformID = senderPlatformID req.MsgData = &msgData req.OperationID = operationID etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 2d0cce613..ebb1de2a2 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -147,10 +147,39 @@ func (s *officeServer) SetTag(_ context.Context, req *pbOffice.SetTagReq) (resp func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagReq) (resp *pbOffice.SendMsg2TagResp, err error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "req: ", req.String()) resp = &pbOffice.SendMsg2TagResp{CommonResp: &pbOffice.CommonResp{}} - userIDList, err := db.DB.GetUserIDListByTagID(req.SendID, req.TagID) - for _, userID := range userIDList { - msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.ContentType) + var tagUserIDList []string + for _, tagID := range req.TagList { + userIDList, err := db.DB.GetUserIDListByTagID(req.SendID, tagID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetUserIDListByTagID failed", err.Error()) + continue + } + tagUserIDList = append(tagUserIDList, userIDList...) } + var groupUserIDList []string + for _, groupID := range req.GroupList { + userIDList, err := im_mysql_model.GetGroupMemberIDListByGroupID(groupID) + if err != nil { + log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID failed", err.Error()) + continue + } + groupUserIDList = append(groupUserIDList, userIDList...) + } + var userIDList []string + userIDList = append(groupUserIDList, tagUserIDList...) + userIDList = append(groupUserIDList, groupUserIDList...) + userIDList = append(groupUserIDList, req.UserList...) + userIDList = utils.RemoveUserIDRepByMap(userIDList) + for i, userID := range userIDList { + if userID == req.SendID { + userIDList = append(userIDList[:i], userIDList[i+1:]...) + } + } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "total userIDList result: ", userIDList) + for _, userID := range userIDList { + msg.TagSendMessage(req.OperationID, req.SendID, userID, req.Content, req.SenderPlatformID) + } + if err := db.DB.SaveTagSendLog(req); err != nil { log.NewError(req.OperationID, utils.GetSelfFuncName(), "SaveTagSendLog failed", err.Error()) resp.CommonResp.ErrCode = constant.ErrDB.ErrCode diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index 6b4472f01..c8a5d8f65 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -72,6 +72,32 @@ func (s *userServer) Run() { log.NewInfo("0", "rpc user success") } +func syncPeerUserConversation(conversation *pbUser.Conversation, operationID string) error { + if conversation.ConversationType == constant.SingleChatType { + peerUserConversation := db.Conversation{ + OwnerUserID: conversation.UserID, + ConversationID: "single_" + conversation.OwnerUserID, + ConversationType: constant.SingleChatType, + UserID: conversation.OwnerUserID, + GroupID: "", + RecvMsgOpt: 0, + UnreadCount: 0, + DraftTextTime: 0, + IsPinned: false, + IsPrivateChat: conversation.IsPrivateChat, + AttachedInfo: "", + Ex: "", + } + err := imdb.CreateConversationIfNotExist(peerUserConversation) + if err != nil { + log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) + return err + } + chat.SetConversationNotification(operationID, conversation.UserID) + } + return nil +} + func (s *userServer) GetUserInfo(ctx context.Context, req *pbUser.GetUserInfoReq) (*pbUser.GetUserInfoResp, error) { log.NewInfo(req.OperationID, "GetUserInfo args ", req.String()) var userInfoList []*sdkws.UserInfo @@ -113,6 +139,9 @@ func (s *userServer) BatchSetConversations(ctx context.Context, req *pbUser.Batc continue } resp.Success = append(resp.Success, v.ConversationID) + //if err := syncPeerUserConversation(v, req.OperationID); err != nil { + // log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error()) + //} } chat.SetConversationNotification(req.OperationID, req.OwnerUserID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String()) @@ -189,6 +218,10 @@ func (s *userServer) SetConversation(ctx context.Context, req *pbUser.SetConvers resp.CommonResp = &pbUser.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg} return resp, nil } + // sync peer user conversation if conversation is singleChatType + //if err := syncPeerUserConversation(req.Conversation, req.OperationID); err != nil { + // log.NewError(req.OperationID, utils.GetSelfFuncName(), "syncPeerUserConversation", err.Error()) + //} chat.SetConversationNotification(req.OperationID, req.Conversation.OwnerUserID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return", resp.String()) resp.CommonResp = &pbUser.CommonResp{} diff --git a/pkg/base_info/office_struct.go b/pkg/base_info/office_struct.go index 65066d0b7..a13255032 100644 --- a/pkg/base_info/office_struct.go +++ b/pkg/base_info/office_struct.go @@ -5,7 +5,7 @@ import ( ) type GetUserTagsReq struct { - OperationID string `json:"operationID"` + OperationID string `json:"operationID" binding:"required"` } type GetUserTagsResp struct { @@ -47,7 +47,10 @@ type SetTagResp struct { } type SendMsg2TagReq struct { - TagID string `json:"tagID" binding:"required"` + TagList []string `json:"tagList"` + UserList []string `json:"userList"` + GroupList []string `json:"groupList"` + SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` Content string `json:"content" binding:"required"` ContentType int32 `json:"contentType" binding:"required"` diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index e503c06ab..36550e50c 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -526,28 +526,25 @@ type TagUser struct { } type TagSendLog struct { - 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:"content_type"` - SendTime int64 `bson:"send_time"` + TagList []string `bson:"tag_list"` + GroupList []string `bson:"group_list"` + UserList []string `bson:"user_list"` + SendID string `bson:"send_id"` + SenderPlatformID int32 `bson:"sender_platform_id"` + Content string `bson:"content"` + 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{"user_id": sendReq.SendID, "tag_id": sendReq.TagID}).Decode(&tag) - c = d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) + c := d.mongoClient.Database(config.Config.Mongo.DBDatabase).Collection(cSendLog) tagSendLog := TagSendLog{ - TagID: sendReq.TagID, - TagName: tag.TagName, + TagList: sendReq.TagList, + GroupList: sendReq.GroupList, + UserList: sendReq.UserList, SendID: sendReq.SendID, SenderPlatformID: sendReq.SenderPlatformID, Content: sendReq.Content, - ContentType: sendReq.ContentType, SendTime: time.Now().Unix(), } _, err := c.InsertOne(ctx, tagSendLog) diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go index f944f0396..493b78e4e 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go @@ -65,6 +65,20 @@ func GetGroupMemberListByGroupID(groupID string) ([]db.GroupMember, error) { return groupMemberList, nil } +func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) { + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return nil, err + } + var groupMemberIDList []string + err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMemberIDList).Error + + if err != nil { + return nil, err + } + return groupMemberIDList, nil +} + func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([]db.GroupMember, error) { dbConn, err := db.DB.MysqlDB.DefaultGormDB() if err != nil { diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index c753396a8..3a37062a7 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -377,3 +377,12 @@ func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conver err = dbConn.Model(&db.Conversation{}).Where("conversation_id IN (?) and owner_user_id=?", conversationIDs, OwnerUserID).Find(&conversations).Error return conversations, err } + +func CreateConversationIfNotExist(conversation db.Conversation) error { + //dbConn, err := db.DB.MysqlDB.DefaultGormDB() + //if err != nil { + // return err + //} + //err = dbConn.Model(&db.Conversation{}).Where().Find().Error + return nil +} diff --git a/pkg/proto/office/office.pb.go b/pkg/proto/office/office.pb.go index b7ee98a38..34648cdb7 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_8580c3f7b2871da9, []int{0} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{1} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{2} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{3} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{4} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{5} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{6} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{7} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{8} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{9} + return fileDescriptor_office_b53660f9aedbfa32, []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_8580c3f7b2871da9, []int{10} + return fileDescriptor_office_b53660f9aedbfa32, []int{10} } func (m *SetTagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SetTagResp.Unmarshal(m, b) @@ -571,12 +571,13 @@ func (m *SetTagResp) GetCommonResp() *CommonResp { } type SendMsg2TagReq struct { - TagID string `protobuf:"bytes,1,opt,name=tagID" json:"tagID,omitempty"` - SendID string `protobuf:"bytes,2,opt,name=sendID" json:"sendID,omitempty"` - SenderPlatformID int32 `protobuf:"varint,3,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"` - Content string `protobuf:"bytes,4,opt,name=content" json:"content,omitempty"` - ContentType int32 `protobuf:"varint,5,opt,name=contentType" json:"contentType,omitempty"` - OperationID string `protobuf:"bytes,6,opt,name=operationID" json:"operationID,omitempty"` + TagList []string `protobuf:"bytes,1,rep,name=tagList" json:"tagList,omitempty"` + UserList []string `protobuf:"bytes,2,rep,name=UserList" json:"UserList,omitempty"` + GroupList []string `protobuf:"bytes,3,rep,name=GroupList" json:"GroupList,omitempty"` + SendID string `protobuf:"bytes,4,opt,name=sendID" json:"sendID,omitempty"` + SenderPlatformID int32 `protobuf:"varint,5,opt,name=senderPlatformID" json:"senderPlatformID,omitempty"` + Content string `protobuf:"bytes,6,opt,name=content" json:"content,omitempty"` + OperationID string `protobuf:"bytes,7,opt,name=operationID" json:"operationID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -586,7 +587,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_8580c3f7b2871da9, []int{11} + return fileDescriptor_office_b53660f9aedbfa32, []int{11} } func (m *SendMsg2TagReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagReq.Unmarshal(m, b) @@ -606,11 +607,25 @@ func (m *SendMsg2TagReq) XXX_DiscardUnknown() { var xxx_messageInfo_SendMsg2TagReq proto.InternalMessageInfo -func (m *SendMsg2TagReq) GetTagID() string { +func (m *SendMsg2TagReq) GetTagList() []string { if m != nil { - return m.TagID + return m.TagList } - return "" + return nil +} + +func (m *SendMsg2TagReq) GetUserList() []string { + if m != nil { + return m.UserList + } + return nil +} + +func (m *SendMsg2TagReq) GetGroupList() []string { + if m != nil { + return m.GroupList + } + return nil } func (m *SendMsg2TagReq) GetSendID() string { @@ -634,13 +649,6 @@ func (m *SendMsg2TagReq) GetContent() string { return "" } -func (m *SendMsg2TagReq) GetContentType() int32 { - if m != nil { - return m.ContentType - } - return 0 -} - func (m *SendMsg2TagReq) GetOperationID() string { if m != nil { return m.OperationID @@ -659,7 +667,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_8580c3f7b2871da9, []int{12} + return fileDescriptor_office_b53660f9aedbfa32, []int{12} } func (m *SendMsg2TagResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_SendMsg2TagResp.Unmarshal(m, b) @@ -699,7 +707,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_8580c3f7b2871da9, []int{13} + return fileDescriptor_office_b53660f9aedbfa32, []int{13} } func (m *GetTagSendLogsReq) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsReq.Unmarshal(m, b) @@ -741,9 +749,9 @@ 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"` + UserList []string `protobuf:"bytes,1,rep,name=userList" json:"userList,omitempty"` + TagList []string `protobuf:"bytes,2,rep,name=tagList" json:"tagList,omitempty"` + GroupList []string `protobuf:"bytes,3,rep,name=groupList" json:"groupList,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:"-"` @@ -755,7 +763,7 @@ 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_8580c3f7b2871da9, []int{14} + return fileDescriptor_office_b53660f9aedbfa32, []int{14} } func (m *TagSendLog) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_TagSendLog.Unmarshal(m, b) @@ -775,25 +783,25 @@ func (m *TagSendLog) XXX_DiscardUnknown() { var xxx_messageInfo_TagSendLog proto.InternalMessageInfo -func (m *TagSendLog) GetTagID() string { +func (m *TagSendLog) GetUserList() []string { if m != nil { - return m.TagID + return m.UserList } - return "" + return nil } -func (m *TagSendLog) GetTagName() string { +func (m *TagSendLog) GetTagList() []string { if m != nil { - return m.TagName + return m.TagList } - return "" + return nil } -func (m *TagSendLog) GetContentType() int32 { +func (m *TagSendLog) GetGroupList() []string { if m != nil { - return m.ContentType + return m.GroupList } - return 0 + return nil } func (m *TagSendLog) GetContent() string { @@ -823,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_8580c3f7b2871da9, []int{15} + return fileDescriptor_office_b53660f9aedbfa32, []int{15} } func (m *GetTagSendLogsResp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_GetTagSendLogsResp.Unmarshal(m, b) @@ -1120,55 +1128,57 @@ var _OfficeService_serviceDesc = grpc.ServiceDesc{ Metadata: "office/office.proto", } -func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_8580c3f7b2871da9) } +func init() { proto.RegisterFile("office/office.proto", fileDescriptor_office_b53660f9aedbfa32) } -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, 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, 0x80, - 0x57, 0x42, 0xe2, 0xca, 0x03, 0x21, 0x21, 0xaf, 0xd7, 0xf6, 0xda, 0x49, 0x04, 0xe4, 0x94, 0x9d, - 0xd9, 0x99, 0xc9, 0xf7, 0x7d, 0xb3, 0x3b, 0x6b, 0xf8, 0x3f, 0x98, 0x4c, 0xbc, 0x11, 0x76, 0xe2, - 0x9f, 0x76, 0xc8, 0x03, 0x19, 0x90, 0x6a, 0x6c, 0xd9, 0x8f, 0x4f, 0x42, 0xf4, 0x87, 0x87, 0xc7, - 0x9d, 0xf0, 0xd2, 0xed, 0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, 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, 0xd9, 0x21, 0xcf, 0xe0, 0x3f, 0x8e, 0xe3, 0x9b, 0x91, 0x19, 0x5d, 0x51, 0xd1, - 0x33, 0xfe, 0xa2, 0x30, 0xd5, 0x59, 0x61, 0xde, 0x02, 0x24, 0x94, 0x96, 0x54, 0xe5, 0x87, 0x05, - 0x9b, 0x67, 0xe8, 0x8f, 0x8f, 0x85, 0xdb, 0xd5, 0xd2, 0xcc, 0xbf, 0xa8, 0x3b, 0x50, 0x15, 0xe8, - 0x8f, 0xb3, 0x23, 0x18, 0x5b, 0x11, 0xa1, 0x68, 0x85, 0xfc, 0xf4, 0x8a, 0xc9, 0x49, 0xc0, 0xa7, - 0xba, 0x85, 0x15, 0x3a, 0xe3, 0x8f, 0x64, 0x1c, 0x05, 0xbe, 0x44, 0x5f, 0xea, 0xa3, 0x98, 0x98, - 0x11, 0x55, 0xbd, 0x1c, 0x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 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, +var fileDescriptor_office_b53660f9aedbfa32 = []byte{ + // 781 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xdd, 0x6a, 0xdb, 0x4a, + 0x10, 0x46, 0xf2, 0x5f, 0x3c, 0x4e, 0xe2, 0x93, 0x3d, 0x39, 0x39, 0xaa, 0x08, 0xad, 0x2b, 0x5a, + 0x08, 0x2d, 0xd8, 0xe0, 0xf6, 0xa2, 0x50, 0x1a, 0x4a, 0xed, 0x60, 0x5c, 0x92, 0x26, 0x28, 0xce, + 0x4d, 0x2f, 0x6a, 0x36, 0xf6, 0x58, 0x88, 0xc4, 0x92, 0xb2, 0x2b, 0x27, 0xf7, 0x7d, 0x85, 0x42, + 0xdf, 0xa8, 0x0f, 0xd0, 0x77, 0xe8, 0x6b, 0x14, 0x8a, 0x56, 0xd2, 0x6a, 0x25, 0xdb, 0x14, 0x7c, + 0x25, 0x7d, 0xb3, 0x33, 0xab, 0x6f, 0xbe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0xc9, 0x9a, 0x41, 0x33, + 0xb7, 0x17, 0x0f, 0x48, 0x17, 0x60, 0x22, 0x15, 0x14, 0x1b, 0x36, 0xba, 0x24, 0x65, 0x93, 0x69, + 0x6b, 0x2b, 0x5e, 0xe4, 0x09, 0x94, 0x43, 0xea, 0x70, 0x43, 0x17, 0xdc, 0x1b, 0x0a, 0x77, 0x5b, + 0x2c, 0x58, 0x5f, 0x35, 0xd8, 0xee, 0x31, 0xa4, 0x21, 0x46, 0x36, 0xbc, 0x53, 0xb5, 0xd0, 0xf2, + 0x5a, 0x64, 0xc9, 0xe8, 0xb9, 0x64, 0x1e, 0x03, 0xc4, 0x6f, 0x52, 0xa5, 0xba, 0xad, 0x58, 0x8a, + 0xc9, 0x96, 0x97, 0x93, 0xed, 0xc1, 0x8e, 0xc2, 0x61, 0xb3, 0x54, 0xad, 0x2f, 0xb0, 0xdd, 0xc7, + 0x5b, 0x94, 0x89, 0xac, 0xd3, 0x5e, 0x1e, 0x01, 0x5d, 0x3d, 0x02, 0x05, 0x92, 0xa5, 0x95, 0x24, + 0x95, 0xfd, 0x37, 0x24, 0xf9, 0x53, 0x83, 0xfa, 0x25, 0x86, 0x1b, 0x51, 0x34, 0xa0, 0xe6, 0xe1, + 0x83, 0xa8, 0x4c, 0x4c, 0x2f, 0x85, 0xa4, 0x0d, 0xc4, 0xf5, 0x26, 0x0c, 0x29, 0xc7, 0xab, 0xac, + 0x12, 0x65, 0x51, 0x89, 0x15, 0x2b, 0xe4, 0x05, 0xfc, 0xc3, 0x70, 0xba, 0x98, 0xa8, 0xde, 0x15, + 0xe1, 0xbd, 0x64, 0x2f, 0x0a, 0x53, 0x5d, 0x16, 0xe6, 0x3d, 0x40, 0x9a, 0xd2, 0x86, 0xaa, 0xfc, + 0xd2, 0x60, 0xf7, 0x12, 0xbd, 0xe9, 0x19, 0x77, 0xba, 0xb9, 0x63, 0x28, 0x98, 0x69, 0x82, 0x59, + 0x0a, 0xa3, 0x2e, 0xbf, 0x4a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x44, 0x7e, 0x0d, 0x8d, 0x30, 0x63, 0x93, + 0xdc, 0x2b, 0x44, 0x99, 0xcd, 0xc9, 0x92, 0xad, 0xba, 0x75, 0x7f, 0xeb, 0xb0, 0x73, 0x2e, 0x5c, + 0x2e, 0x91, 0xdd, 0xbb, 0x13, 0x24, 0xc7, 0xd0, 0x50, 0xee, 0x08, 0x72, 0x90, 0xee, 0x90, 0xbf, + 0x84, 0xcc, 0xff, 0x57, 0xda, 0x79, 0x40, 0xde, 0x40, 0x5d, 0x8e, 0x5d, 0xb2, 0x2f, 0x73, 0x57, + 0x6e, 0x03, 0xf3, 0xbf, 0x15, 0xd6, 0x38, 0x52, 0xce, 0xc2, 0x2c, 0x52, 0x1d, 0xbf, 0x59, 0x64, + 0x7e, 0x68, 0x76, 0xa0, 0x1a, 0x0f, 0x0b, 0xb2, 0x97, 0x3a, 0xc8, 0x79, 0x68, 0x92, 0xa2, 0x89, + 0x07, 0x51, 0x92, 0x4a, 0xd3, 0x64, 0x49, 0xe6, 0xe7, 0x45, 0x96, 0x64, 0xb1, 0xc3, 0x06, 0xe2, + 0x52, 0x56, 0xaa, 0x4f, 0x1e, 0x29, 0x7a, 0xe4, 0x9b, 0xc8, 0x34, 0xd7, 0x2d, 0xf1, 0xe0, 0xc3, + 0xde, 0xe7, 0x66, 0x3b, 0xf9, 0xfb, 0x79, 0x1b, 0x3f, 0xae, 0xab, 0xe2, 0xd7, 0xe6, 0xd5, 0x9f, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x36, 0xc4, 0xe9, 0x1c, 0x09, 0x00, 0x00, } diff --git a/pkg/proto/office/office.proto b/pkg/proto/office/office.proto index bb0a59b0a..99c749dbb 100644 --- a/pkg/proto/office/office.proto +++ b/pkg/proto/office/office.proto @@ -64,12 +64,13 @@ message SetTagResp { } message SendMsg2TagReq { - string tagID = 1; - string sendID = 2; - int32 senderPlatformID = 3; - string content = 4; - int32 contentType = 5; - string operationID = 6; + repeated string tagList = 1; + repeated string UserList = 2; + repeated string GroupList = 3; + string sendID = 4; + int32 senderPlatformID = 5; + string content = 6; + string operationID = 7; } message SendMsg2TagResp { @@ -83,9 +84,9 @@ message GetTagSendLogsReq { } message TagSendLog { - string tagID = 1; - string tagName = 2; - int32 contentType = 3; + repeated string userList = 1; + repeated string tagList = 2; + repeated string groupList =3; string content = 4; int64 sendTime = 5; } From 416f87f4bb963008b5fca8d3d0fd5074ee7b3f0c Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 15:50:20 +0800 Subject: [PATCH 2/8] tag --- internal/rpc/office/office.go | 6 +++--- pkg/common/db/mongoModel.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index ebb1de2a2..508d0c04c 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -166,9 +166,9 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR groupUserIDList = append(groupUserIDList, userIDList...) } var userIDList []string - userIDList = append(groupUserIDList, tagUserIDList...) - userIDList = append(groupUserIDList, groupUserIDList...) - userIDList = append(groupUserIDList, req.UserList...) + userIDList = append(userIDList, tagUserIDList...) + userIDList = append(userIDList, groupUserIDList...) + userIDList = append(userIDList, req.UserList...) userIDList = utils.RemoveUserIDRepByMap(userIDList) for i, userID := range userIDList { if userID == req.SendID { diff --git a/pkg/common/db/mongoModel.go b/pkg/common/db/mongoModel.go index 36550e50c..bcc05a295 100644 --- a/pkg/common/db/mongoModel.go +++ b/pkg/common/db/mongoModel.go @@ -568,7 +568,7 @@ func (d *DataBases) GetTagSendLogs(userID string, showNumber, pageNumber int32) } func generateTagID(tagName, userID string) string { - return utils.Md5(tagName + userID + strconv.Itoa(rand.Int())) + return utils.Md5(tagName + userID + strconv.Itoa(rand.Int()) + time.Now().String()) } func getCurrentTimestampByMill() int64 { From d0a65c7c68347eafb005a2e5ab763a29950228b3 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 15:58:42 +0800 Subject: [PATCH 3/8] tag --- internal/rpc/office/office.go | 1 + pkg/common/db/mysql_model/im_mysql_model/group_member_model.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 508d0c04c..8f177abcb 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -165,6 +165,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR } groupUserIDList = append(groupUserIDList, userIDList...) } + log.NewDebug(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList) var userIDList []string userIDList = append(userIDList, tagUserIDList...) userIDList = append(userIDList, groupUserIDList...) diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go index acf5a7a15..2eb0b591f 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go @@ -73,9 +73,9 @@ func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) { if err != nil { return nil, err } + dbConn.LogMode(true) var groupMemberIDList []string err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMemberIDList).Error - if err != nil { return nil, err } From fe4b534b781ad6c9ac77b21e92fdc6b06dcefc20 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Tue, 29 Mar 2022 16:04:15 +0800 Subject: [PATCH 4/8] mute group --- cmd/Open-IM-SDK-Core | 2 +- config/config.yaml | 50 ++++++++++++++++++ internal/rpc/group/group.go | 6 ++- internal/rpc/msg/group_notification.go | 73 ++++++++++++++++++++++++++ internal/rpc/msg/send_msg.go | 32 +++++++++++ pkg/common/config/config.go | 24 +++++++++ pkg/common/constant/constant.go | 5 +- 7 files changed, 188 insertions(+), 4 deletions(-) diff --git a/cmd/Open-IM-SDK-Core b/cmd/Open-IM-SDK-Core index a19440c3d..a6b33ab9d 160000 --- a/cmd/Open-IM-SDK-Core +++ b/cmd/Open-IM-SDK-Core @@ -1 +1 @@ -Subproject commit a19440c3d6e6504655934cc432d8420bb1909816 +Subproject commit a6b33ab9d277ef82e1e0e12c4affb49b53758735 diff --git a/config/config.yaml b/config/config.yaml index 7d864283c..a801d7c57 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -366,6 +366,56 @@ notification: ext: "groupDismissed ext" defaultTips: tips: "group dismissed" + + + groupMuted: + conversation: + reliabilityLevel: 3 + unreadCount: true + offlinePush: + switch: false + title: "groupMuted title" + desc: "groupMuted desc" + ext: "groupMuted ext" + defaultTips: + tips: "group Muted" + + groupCancelMuted: + conversation: + reliabilityLevel: 3 + unreadCount: true + offlinePush: + switch: false + title: "groupCancelMuted title" + desc: "groupCancelMuted desc" + ext: "groupCancelMuted ext" + defaultTips: + tips: "group Cancel Muted" + + + groupMemberMuted: + conversation: + reliabilityLevel: 3 + unreadCount: true + offlinePush: + switch: false + title: "groupMemberMuted title" + desc: "groupMemberMuted desc" + ext: "groupMemberMuted ext" + defaultTips: + tips: "group Member Muted" + + groupMemberCancelMuted: + conversation: + reliabilityLevel: 3 + unreadCount: true + offlinePush: + switch: false + title: "groupMemberCancelMuted title" + desc: "groupMemberCancelMuted desc" + ext: "groupMemberCancelMuted ext" + defaultTips: + tips: "group Member Cancel Muted" #############################friend################################# friendApplicationAdded: diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 98198f598..eefbcac9c 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -980,6 +980,7 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo) return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } + chat.GroupMemberMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID, req.MutedSeconds) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}) return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil } @@ -997,6 +998,7 @@ func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.Ca log.Error(req.OperationID, "UpdateGroupMemberInfo failed ", err.Error(), groupMemberInfo) return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } + chat.GroupMemberCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID, req.UserID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}) return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil } @@ -1012,7 +1014,7 @@ func (s *groupServer) MuteGroup(ctx context.Context, req *pbGroup.MuteGroupReq) log.Error(req.OperationID, "OperateGroupStatus failed ", err.Error(), req.GroupID, constant.GroupStatusMuted) return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } - chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID) + chat.GroupMutedNotification(req.OperationID, req.OpUserID, req.GroupID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}) return &pbGroup.MuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil } @@ -1030,7 +1032,7 @@ func (s *groupServer) CancelMuteGroup(ctx context.Context, req *pbGroup.CancelMu log.Error(req.OperationID, "UpdateGroupInfoDefaultZero failed ", err.Error(), groupInfo) return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrDB.ErrCode, ErrMsg: constant.ErrDB.ErrMsg}}, nil } - chat.GroupInfoSetNotification(req.OperationID, req.OpUserID, req.GroupID) + chat.GroupCancelMutedNotification(req.OperationID, req.OpUserID, req.GroupID) log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc return ", pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}) return &pbGroup.CancelMuteGroupResp{CommonResp: &pbGroup.CommonResp{ErrCode: 0, ErrMsg: ""}}, nil } diff --git a/internal/rpc/msg/group_notification.go b/internal/rpc/msg/group_notification.go index f5155889b..d6def3ff2 100644 --- a/internal/rpc/msg/group_notification.go +++ b/internal/rpc/msg/group_notification.go @@ -160,6 +160,14 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv tips.DefaultTips = toNickname + " " + cn.MemberEnter.DefaultTips.Tips case constant.GroupDismissedNotification: tips.DefaultTips = toNickname + "" + cn.GroupDismissed.DefaultTips.Tips + case constant.GroupMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMuted.DefaultTips.Tips + case constant.GroupCancelMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupCancelMuted.DefaultTips.Tips + case constant.GroupMemberMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberMuted.DefaultTips.Tips + case constant.GroupMemberCancelMutedNotification: + tips.DefaultTips = toNickname + "" + cn.GroupMemberCancelMuted.DefaultTips.Tips default: log.Error(operationID, "contentType failed ", contentType) return @@ -227,6 +235,71 @@ func GroupInfoSetNotification(operationID, opUserID, groupID string) { groupNotification(constant.GroupInfoSetNotification, &GroupInfoChangedTips, opUserID, groupID, "", operationID) } +func GroupMutedNotification(operationID, opUserID, groupID string) { + tips := open_im_sdk.GroupMutedTips{Group: &open_im_sdk.GroupInfo{}, + OpUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(groupID, tips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + groupNotification(constant.GroupMutedNotification, &tips, opUserID, groupID, "", operationID) +} + +func GroupCancelMutedNotification(operationID, opUserID, groupID string) { + tips := open_im_sdk.GroupCancelMutedTips{Group: &open_im_sdk.GroupInfo{}, + OpUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(groupID, tips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + groupNotification(constant.GroupCancelMutedNotification, &tips, opUserID, groupID, "", operationID) +} + +func GroupMemberMutedNotification(operationID, opUserID, groupID, groupMemberUserID string, mutedSeconds uint32) { + tips := open_im_sdk.GroupMemberMutedTips{Group: &open_im_sdk.GroupInfo{}, + OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}} + tips.MutedSeconds = mutedSeconds + if err := setGroupInfo(groupID, tips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) + return + } + groupNotification(constant.GroupMemberMutedNotification, &tips, opUserID, groupID, "", operationID) +} + +func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) { + tips := open_im_sdk.GroupMemberCancelMutedTips{Group: &open_im_sdk.GroupInfo{}, + OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}} + if err := setGroupInfo(groupID, tips.Group); err != nil { + log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID) + return + } + if err := setOpUserInfo(opUserID, groupID, tips.OpUser); err != nil { + log.Error(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID) + return + } + if err := setGroupMemberInfo(groupID, groupMemberUserID, tips.MutedUser); err != nil { + log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID, groupMemberUserID) + return + } + groupNotification(constant.GroupMemberCancelMutedNotification, &tips, opUserID, groupID, "", operationID) +} + //message ReceiveJoinApplicationTips{ // GroupInfo Group = 1; // PublicUserInfo Applicant = 2; diff --git a/internal/rpc/msg/send_msg.go b/internal/rpc/msg/send_msg.go index 2820bd8ad..de189a048 100644 --- a/internal/rpc/msg/send_msg.go +++ b/internal/rpc/msg/send_msg.go @@ -513,6 +513,38 @@ func Notification(n *NotificationMsg) { ex = config.Config.Notification.GroupDismissed.OfflinePush.Ext reliabilityLevel = config.Config.Notification.GroupDismissed.Conversation.ReliabilityLevel unReadCount = config.Config.Notification.GroupDismissed.Conversation.UnreadCount + + case constant.GroupMutedNotification: + pushSwitch = config.Config.Notification.GroupMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMuted.Conversation.UnreadCount + + case constant.GroupCancelMutedNotification: + pushSwitch = config.Config.Notification.GroupCancelMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupCancelMuted.OfflinePush.Title + desc = config.Config.Notification.GroupCancelMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupCancelMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupCancelMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupCancelMuted.Conversation.UnreadCount + + case constant.GroupMemberMutedNotification: + pushSwitch = config.Config.Notification.GroupMemberMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMemberMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMemberMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMemberMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMemberMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMemberMuted.Conversation.UnreadCount + + case constant.GroupMemberCancelMutedNotification: + pushSwitch = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.PushSwitch + title = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Title + desc = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Desc + ex = config.Config.Notification.GroupMemberCancelMuted.OfflinePush.Ext + reliabilityLevel = config.Config.Notification.GroupMemberCancelMuted.Conversation.ReliabilityLevel + unReadCount = config.Config.Notification.GroupMemberCancelMuted.Conversation.UnreadCount } switch reliabilityLevel { case constant.UnreliableNotification: diff --git a/pkg/common/config/config.go b/pkg/common/config/config.go index 2a8ec36ff..2a9759cc7 100644 --- a/pkg/common/config/config.go +++ b/pkg/common/config/config.go @@ -270,6 +270,30 @@ type config struct { DefaultTips PDefaultTips `yaml:"defaultTips"` } `yaml:"groupDismissed"` + GroupMuted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } `yaml:"groupMuted"` + + GroupCancelMuted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } `yaml:"groupCancelMuted"` + + GroupMemberMuted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } `yaml:"groupMemberMuted"` + + GroupMemberCancelMuted struct { + Conversation PConversation `yaml:"conversation"` + OfflinePush POfflinePush `yaml:"offlinePush"` + DefaultTips PDefaultTips `yaml:"defaultTips"` + } `yaml:"groupMemberCancelMuted"` + ////////////////////////user/////////////////////// UserInfoUpdated struct { Conversation PConversation `yaml:"conversation"` diff --git a/pkg/common/constant/constant.go b/pkg/common/constant/constant.go index 0a1e38168..a38076e7b 100644 --- a/pkg/common/constant/constant.go +++ b/pkg/common/constant/constant.go @@ -79,7 +79,10 @@ const ( MemberInvitedNotification = 1509 MemberEnterNotification = 1510 GroupDismissedNotification = 1511 - GroupMemberInfoChangedNotification = 1512 + GroupMemberMutedNotification = 1512 + GroupMemberCancelMutedNotification = 1513 + GroupMutedNotification = 1514 + GroupCancelMutedNotification = 1515 SignalingNotificationBegin = 1600 SignalingNotification = 1601 From 7e937d7d293ebc53abe7792dbb8633c548c58caa Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 16:04:54 +0800 Subject: [PATCH 5/8] tag --- internal/rpc/office/office.go | 2 +- internal/rpc/user/user.go | 1 + pkg/common/db/mysql_model/im_mysql_model/user_model.go | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index 8f177abcb..ac691190a 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -165,7 +165,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR } groupUserIDList = append(groupUserIDList, userIDList...) } - log.NewDebug(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList) + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList) var userIDList []string userIDList = append(userIDList, tagUserIDList...) userIDList = append(userIDList, groupUserIDList...) diff --git a/internal/rpc/user/user.go b/internal/rpc/user/user.go index c8a5d8f65..f83e0e551 100644 --- a/internal/rpc/user/user.go +++ b/internal/rpc/user/user.go @@ -93,6 +93,7 @@ func syncPeerUserConversation(conversation *pbUser.Conversation, operationID str log.NewError(operationID, utils.GetSelfFuncName(), "SetConversation error", err.Error()) return err } + chat.SetConversationNotification(operationID, conversation.UserID) } return nil diff --git a/pkg/common/db/mysql_model/im_mysql_model/user_model.go b/pkg/common/db/mysql_model/im_mysql_model/user_model.go index 3a37062a7..ab367a5ff 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/user_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/user_model.go @@ -379,10 +379,10 @@ func GetConversations(OwnerUserID string, conversationIDs []string) ([]db.Conver } func CreateConversationIfNotExist(conversation db.Conversation) error { - //dbConn, err := db.DB.MysqlDB.DefaultGormDB() - //if err != nil { - // return err - //} - //err = dbConn.Model(&db.Conversation{}).Where().Find().Error + dbConn, err := db.DB.MysqlDB.DefaultGormDB() + if err != nil { + return err + } + err = dbConn.Model(&db.Conversation{}).Create(conversation).Error return nil } From f2b324abc2e3302b0fff76c05d82bbf66b269c32 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 16:10:36 +0800 Subject: [PATCH 6/8] tag --- internal/rpc/office/office.go | 3 ++- .../db/mysql_model/im_mysql_model/group_member_model.go | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/rpc/office/office.go b/internal/rpc/office/office.go index ac691190a..e96475773 100644 --- a/internal/rpc/office/office.go +++ b/internal/rpc/office/office.go @@ -163,6 +163,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR log.NewError(req.OperationID, utils.GetSelfFuncName(), "GetGroupMemberIDListByGroupID failed", err.Error()) continue } + log.NewInfo(req.OperationID, utils.GetSelfFuncName(), userIDList) groupUserIDList = append(groupUserIDList, userIDList...) } log.NewInfo(req.OperationID, utils.GetSelfFuncName(), groupUserIDList, req.GroupList) @@ -172,7 +173,7 @@ func (s *officeServer) SendMsg2Tag(_ context.Context, req *pbOffice.SendMsg2TagR userIDList = append(userIDList, req.UserList...) userIDList = utils.RemoveUserIDRepByMap(userIDList) for i, userID := range userIDList { - if userID == req.SendID { + if userID == req.SendID || userID == "" { userIDList = append(userIDList[:i], userIDList[i+1:]...) } } diff --git a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go index 2eb0b591f..90e0a26e7 100644 --- a/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go +++ b/pkg/common/db/mysql_model/im_mysql_model/group_member_model.go @@ -74,11 +74,15 @@ func GetGroupMemberIDListByGroupID(groupID string) ([]string, error) { return nil, err } dbConn.LogMode(true) - var groupMemberIDList []string - err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMemberIDList).Error + var groupMembers []db.GroupMember + err = dbConn.Table("group_members").Select("user_id").Where("group_id=?", groupID).Find(&groupMembers).Error if err != nil { return nil, err } + var groupMemberIDList []string + for _, v := range groupMembers { + groupMemberIDList = append(groupMemberIDList, v.UserID) + } return groupMemberIDList, nil } From 1bd8154ac4b80ed7e14ca042b5b5c7af54671133 Mon Sep 17 00:00:00 2001 From: wangchuxiao Date: Tue, 29 Mar 2022 16:15:37 +0800 Subject: [PATCH 7/8] tag --- pkg/base_info/office_struct.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/base_info/office_struct.go b/pkg/base_info/office_struct.go index a13255032..ac22c2239 100644 --- a/pkg/base_info/office_struct.go +++ b/pkg/base_info/office_struct.go @@ -53,7 +53,6 @@ type SendMsg2TagReq struct { SenderPlatformID int32 `json:"senderPlatformID" binding:"required"` Content string `json:"content" binding:"required"` - ContentType int32 `json:"contentType" binding:"required"` OperationID string `json:"operationID" binding:"required"` } From 475e64fc5b89d347a47ebd3a4a09c316c6674756 Mon Sep 17 00:00:00 2001 From: skiffer-git <44203734@qq.com> Date: Tue, 29 Mar 2022 16:32:25 +0800 Subject: [PATCH 8/8] mute group --- internal/rpc/group/group.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index eefbcac9c..a279603ad 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -969,7 +969,7 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGroupMemberReq) (*pbGroup.MuteGroupMemberResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) - if !imdb.IsGroupOwnerAdmin(req.GroupID, req.UserID) && !token_verify.IsMangerUserID(req.OpUserID) { + if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) { log.Error(req.OperationID, "verify failed ", req.GroupID, req.UserID) return &pbGroup.MuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil } @@ -987,7 +987,7 @@ func (s *groupServer) MuteGroupMember(ctx context.Context, req *pbGroup.MuteGrou func (s *groupServer) CancelMuteGroupMember(ctx context.Context, req *pbGroup.CancelMuteGroupMemberReq) (*pbGroup.CancelMuteGroupMemberResp, error) { log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "rpc args ", req.String()) - if !imdb.IsGroupOwnerAdmin(req.GroupID, req.UserID) && !token_verify.IsMangerUserID(req.OpUserID) { + if !imdb.IsGroupOwnerAdmin(req.GroupID, req.OpUserID) && !token_verify.IsMangerUserID(req.OpUserID) { log.Error(req.OperationID, "verify failed ", req.OpUserID, req.GroupID) return &pbGroup.CancelMuteGroupMemberResp{CommonResp: &pbGroup.CommonResp{ErrCode: constant.ErrAccess.ErrCode, ErrMsg: constant.ErrAccess.ErrMsg}}, nil }