group rpc

This commit is contained in:
withchao
2023-02-06 18:33:33 +08:00
parent 7d3b203d03
commit 4f96cc9b1b
4 changed files with 135 additions and 141 deletions
+20
View File
@@ -1,7 +1,9 @@
package group
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/tracelog"
pbConversation "Open_IM/pkg/proto/conversation"
sdk_ws "Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"context"
@@ -62,6 +64,24 @@ func GetPublicUserInfoMap(ctx context.Context, userIDs []string) (map[string]*sd
}), nil
}
func GroupNotification(ctx context.Context, groupID string) {
var conversationReq pbConversation.ModifyConversationFieldReq
conversation := pbConversation.Conversation{
OwnerUserID: tracelog.GetOpUserID(ctx),
ConversationID: utils.GetConversationIDBySessionType(groupID, constant.GroupChatType),
ConversationType: constant.GroupChatType,
GroupID: groupID,
}
conversationReq.Conversation = &conversation
conversationReq.OperationID = tracelog.GetOperationID(ctx)
conversationReq.FieldType = constant.FieldGroupAtType
conversation.GroupAtType = constant.GroupNotification
conversationReq.UserIDList = cacheResp.UserIDList
_, err = pbConversation.NewConversationClient(s.etcdConn.GetConn("", config.Config.RpcRegisterName.OpenImConversationName)).ModifyConversationField(ctx, &conversationReq)
tracelog.SetCtxInfo(ctx, "ModifyConversationField", err, "req", &conversationReq, "resp", conversationReply)
}
func genGroupID(ctx context.Context, groupID string) string {
if groupID != "" {
return groupID