From f8bacd1dc2040a5eed82ea945cc5ae065e8da85b Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Sun, 4 Jun 2023 10:58:32 +0800 Subject: [PATCH] GroupDismissedNotification --- internal/rpc/group/group.go | 9 +++-- pkg/rpcclient/notification/group.go | 51 +++++++++++++++-------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/internal/rpc/group/group.go b/internal/rpc/group/group.go index 95169e417..382dc3244 100644 --- a/internal/rpc/group/group.go +++ b/internal/rpc/group/group.go @@ -1111,17 +1111,16 @@ func (s *groupServer) DismissGroup(ctx context.Context, req *pbGroup.DismissGrou } else { if !req.DeleteMember { //s.Notification.GroupDismissedNotification(ctx, req) - tips := &sdkws.GroupInfoSetTips{ - Group: s.groupDB2PB(group, owner.UserID, uint32(len(userIDs))), - MuteTime: 0, - OpUser: &sdkws.GroupMemberFullInfo{}, + tips := &sdkws.GroupDismissedTips{ + Group: s.groupDB2PB(group, owner.UserID, uint32(len(userIDs))), + OpUser: &sdkws.GroupMemberFullInfo{}, } if mcontext.GetOpUserID(ctx) == owner.UserID { tips.OpUser = s.groupMemberDB2PB(owner, 0) } else { tips.OpUser = &sdkws.GroupMemberFullInfo{UserID: mcontext.GetOpUserID(ctx)} } - s.Notification.GroupInfoSetNotification(ctx, tips) + s.Notification.GroupDismissedNotification(ctx, tips) } } return resp, nil diff --git a/pkg/rpcclient/notification/group.go b/pkg/rpcclient/notification/group.go index 10a969b8a..2de52f724 100644 --- a/pkg/rpcclient/notification/group.go +++ b/pkg/rpcclient/notification/group.go @@ -542,31 +542,32 @@ func (g *GroupNotificationSender) MemberEnterNotification(ctx context.Context, r return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberEnterNotification, tips) } -func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, req *pbGroup.DismissGroupReq) (err error) { - defer log.ZDebug(ctx, "return") - defer func() { - if err != nil { - log.ZError(ctx, utils.GetFuncName(1)+" failed", err) - } - }() - group, err := g.getGroupInfo(ctx, req.GroupID) - if err != nil { - return err - } - users, err := g.getGroupMembers(ctx, req.GroupID, []string{mcontext.GetOpUserID(ctx)}) - if err != nil { - return err - } - tips := &sdkws.GroupDismissedTips{Group: group} - if len(users) > 0 { - tips.OpUser = users[0] - } else { - tips.OpUser = &sdkws.GroupMemberFullInfo{ - GroupID: group.GroupID, - UserID: mcontext.GetOpUserID(ctx), - } - } - return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupDismissedNotification, tips) +func (g *GroupNotificationSender) GroupDismissedNotification(ctx context.Context, tips *sdkws.GroupDismissedTips) (err error) { + //defer log.ZDebug(ctx, "return") + //defer func() { + // if err != nil { + // log.ZError(ctx, utils.GetFuncName(1)+" failed", err) + // } + //}() + //group, err := g.getGroupInfo(ctx, req.GroupID) + //if err != nil { + // return err + //} + //users, err := g.getGroupMembers(ctx, req.GroupID, []string{mcontext.GetOpUserID(ctx)}) + //if err != nil { + // return err + //} + //tips := &sdkws.GroupDismissedTips{Group: group} + //if len(users) > 0 { + // tips.OpUser = users[0] + //} else { + // tips.OpUser = &sdkws.GroupMemberFullInfo{ + // GroupID: group.GroupID, + // UserID: mcontext.GetOpUserID(ctx), + // } + //} + //return g.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupDismissedNotification, tips) + return g.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.GroupDismissedNotification, tips) } func (g *GroupNotificationSender) GroupMemberMutedNotification(ctx context.Context, groupID, groupMemberUserID string, mutedSeconds uint32) (err error) {