mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Merge remote-tracking branch 'origin/v3dev' into v3dev
This commit is contained in:
commit
ffe7cc3b10
@ -1,19 +1,23 @@
|
|||||||
package group
|
package group
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mcontext"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
pbGroup "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
|
||||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateGroupInfoMap(group *sdkws.GroupInfoForSet) map[string]any {
|
func UpdateGroupInfoMap(ctx context.Context, group *sdkws.GroupInfoForSet) map[string]any {
|
||||||
m := make(map[string]any)
|
m := make(map[string]any)
|
||||||
if group.GroupName != "" {
|
if group.GroupName != "" {
|
||||||
m["name"] = group.GroupName
|
m["name"] = group.GroupName
|
||||||
}
|
}
|
||||||
if group.Notification != "" {
|
if group.Notification != "" {
|
||||||
m["Notification"] = group.Notification
|
m["notification"] = group.Notification
|
||||||
|
m["notification_update_time"] = time.Now()
|
||||||
|
m["notification_user_id"] = mcontext.GetOpUserID(ctx)
|
||||||
}
|
}
|
||||||
if group.Introduction != "" {
|
if group.Introduction != "" {
|
||||||
m["introduction"] = group.Introduction
|
m["introduction"] = group.Introduction
|
||||||
|
@ -3,6 +3,8 @@ package group
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
pbConversation "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/conversation"
|
||||||
|
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/wrapperspb"
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -844,7 +846,7 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
data := UpdateGroupInfoMap(req.GroupInfoForSet)
|
data := UpdateGroupInfoMap(ctx, req.GroupInfoForSet)
|
||||||
if len(data) == 0 {
|
if len(data) == 0 {
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
@ -865,6 +867,23 @@ func (s *groupServer) SetGroupInfo(ctx context.Context, req *pbGroup.SetGroupInf
|
|||||||
}
|
}
|
||||||
var num int
|
var num int
|
||||||
if req.GroupInfoForSet.Notification != "" {
|
if req.GroupInfoForSet.Notification != "" {
|
||||||
|
go func() {
|
||||||
|
nctx := mcontext.NewCtx("@@@" + mcontext.GetOperationID(ctx))
|
||||||
|
conversation := &pbConversation.ConversationReq{
|
||||||
|
ConversationID: utils.GetConversationIDBySessionType(constant.SuperGroupChatType, req.GroupInfoForSet.GroupID),
|
||||||
|
ConversationType: constant.SuperGroupChatType,
|
||||||
|
GroupID: req.GroupInfoForSet.GroupID,
|
||||||
|
}
|
||||||
|
resp, err := s.GetGroupMemberUserIDs(nctx, &pbGroup.GetGroupMemberUserIDsReq{GroupID: req.GroupInfoForSet.GroupID})
|
||||||
|
if err != nil {
|
||||||
|
log.ZWarn(ctx, "GetGroupMemberIDs", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
conversation.GroupAtType = &wrapperspb.Int32Value{Value: constant.GroupNotification}
|
||||||
|
if err := s.conversationRpcClient.SetConversations(nctx, resp.UserIDs, conversation); err != nil {
|
||||||
|
log.ZWarn(ctx, "SetConversations", err, resp.UserIDs, conversation)
|
||||||
|
}
|
||||||
|
}()
|
||||||
num++
|
num++
|
||||||
s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
s.Notification.GroupInfoSetAnnouncementNotification(ctx, &sdkws.GroupInfoSetAnnouncementTips{Group: tips.Group, OpUser: tips.OpUser})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user