mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-24 10:38:15 +08:00
修改好友remark,通知群资料更新
This commit is contained in:
parent
e121cf0fd9
commit
2e39bd1d9c
@ -153,6 +153,24 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *groupServer) NotificationFriendRemarkUpdate(ctx context.Context, req *pbgroup.NotificationFriendRemarkUpdateReq) (*pbgroup.NotificationFriendRemarkUpdateResp, error) {
|
||||
ownerGroupIDs, err := s.db.FindJoinGroupID(ctx, req.OwnerUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(ownerGroupIDs) == 0 {
|
||||
return &pbgroup.NotificationFriendRemarkUpdateResp{}, nil
|
||||
}
|
||||
commonMembers, err := s.db.FindGroupMemberUser(ctx, ownerGroupIDs, req.FriendUserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, member := range commonMembers {
|
||||
s.notification.GroupMemberInfoSetNotification(ctx, member.GroupID, req.FriendUserID)
|
||||
}
|
||||
return &pbgroup.NotificationFriendRemarkUpdateResp{}, nil
|
||||
}
|
||||
|
||||
func (s *groupServer) NotificationUserInfoUpdate(ctx context.Context, req *pbgroup.NotificationUserInfoUpdateReq) (*pbgroup.NotificationUserInfoUpdateResp, error) {
|
||||
members, err := s.db.FindGroupMemberUser(ctx, nil, req.UserID)
|
||||
if err != nil {
|
||||
|
||||
@ -20,6 +20,7 @@ import (
|
||||
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/notification/common_user"
|
||||
"github.com/openimsdk/open-im-server/v3/pkg/rpcli"
|
||||
pbgroup "github.com/openimsdk/protocol/group"
|
||||
|
||||
"github.com/openimsdk/tools/mq/memamq"
|
||||
|
||||
@ -65,6 +66,7 @@ type friendServer struct {
|
||||
queue *memamq.MemoryQueue
|
||||
userClient *rpcli.UserClient
|
||||
conversationClient *rpcli.ConversationClient
|
||||
groupClient *rpcli.GroupClient
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@ -126,6 +128,10 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
groupConn, err := client.GetConn(ctx, config.Share.RpcRegisterName.Group)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
userClient := rpcli.NewUserClient(userConn)
|
||||
|
||||
database := controller.NewFriendDatabase(
|
||||
@ -159,6 +165,7 @@ func Start(ctx context.Context, config *Config, client discovery.SvcDiscoveryReg
|
||||
queue: memamq.NewMemoryQueue(16, 1024*1024),
|
||||
userClient: userClient,
|
||||
conversationClient: rpcli.NewConversationClient(conversationConn),
|
||||
groupClient: rpcli.NewGroupClient(groupConn),
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@ -330,6 +337,15 @@ func (s *friendServer) SetFriendRemark(ctx context.Context, req *relation.SetFri
|
||||
|
||||
s.webhookAfterSetFriendRemark(ctx, &s.config.WebhooksConfig.AfterSetFriendRemark, req)
|
||||
s.notificationSender.FriendRemarkSetNotification(ctx, req.OwnerUserID, req.FriendUserID)
|
||||
go func() {
|
||||
noCancelCtx := context.WithoutCancel(ctx)
|
||||
if _, err := s.groupClient.NotificationFriendRemarkUpdate(noCancelCtx, &pbgroup.NotificationFriendRemarkUpdateReq{
|
||||
OwnerUserID: req.OwnerUserID,
|
||||
FriendUserID: req.FriendUserID,
|
||||
}); err != nil {
|
||||
log.ZError(noCancelCtx, "NotificationFriendRemarkUpdate", err, "ownerUserID", req.OwnerUserID, "friendUserID", req.FriendUserID)
|
||||
}
|
||||
}()
|
||||
|
||||
return &relation.SetFriendRemarkResp{}, nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user