mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
groupServer
This commit is contained in:
parent
1c8df25603
commit
c3345af45a
@ -471,10 +471,47 @@ func (s *groupServer) KickGroupMember(ctx context.Context, req *pbGroup.KickGrou
|
||||
return nil, errs.ErrNoPermission.Wrap("opUserID is OrdinaryUser")
|
||||
}
|
||||
}
|
||||
userIDs, err := s.GroupDatabase.FindGroupMemberUserID(ctx, req.GroupID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
owner, err := s.GroupDatabase.FindGroupMember(ctx, []string{req.GroupID}, nil, []int32{constant.GroupOwner})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := s.GroupDatabase.DeleteGroupMember(ctx, group.GroupID, req.KickedUserIDs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.Notification.MemberKickedNotification(ctx, req, req.KickedUserIDs)
|
||||
tips := &sdkws.MemberKickedTips{
|
||||
Group: &sdkws.GroupInfo{
|
||||
GroupID: group.GroupID,
|
||||
GroupName: group.GroupName,
|
||||
Notification: group.Notification,
|
||||
Introduction: group.Introduction,
|
||||
FaceURL: group.FaceURL,
|
||||
//OwnerUserID: owner[0].UserID,
|
||||
CreateTime: group.CreateTime.UnixMilli(),
|
||||
MemberCount: uint32(len(userIDs)),
|
||||
Ex: group.Ex,
|
||||
Status: group.Status,
|
||||
CreatorUserID: group.CreatorUserID,
|
||||
GroupType: group.GroupType,
|
||||
NeedVerification: group.NeedVerification,
|
||||
LookMemberInfo: group.LookMemberInfo,
|
||||
ApplyMemberFriend: group.ApplyMemberFriend,
|
||||
NotificationUpdateTime: group.NotificationUpdateTime.UnixMilli(),
|
||||
NotificationUserID: group.NotificationUserID,
|
||||
},
|
||||
OpUser: convert.Db2PbGroupMembersCMSResp(memberMap[opUserID]),
|
||||
KickedUserList: []*sdkws.GroupMemberFullInfo{},
|
||||
}
|
||||
if len(owner) > 0 {
|
||||
tips.Group.OwnerUserID = owner[0].UserID
|
||||
}
|
||||
for _, userID := range req.KickedUserIDs {
|
||||
tips.KickedUserList = append(tips.KickedUserList, convert.Db2PbGroupMembersCMSResp(memberMap[userID]))
|
||||
}
|
||||
s.Notification.MemberKickedNotification(ctx, tips)
|
||||
}
|
||||
if err := s.deleteMemberAndSetConversationSeq(ctx, req.GroupID, req.KickedUserIDs); err != nil {
|
||||
return nil, err
|
||||
|
@ -453,30 +453,30 @@ func (g *GroupNotificationSender) GroupOwnerTransferredNotification(ctx context.
|
||||
return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.GroupOwnerTransferredNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, req *pbGroup.KickGroupMemberReq, kickedUserIDList []string) (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
|
||||
}
|
||||
user, err := g.getGroupMember(ctx, req.GroupID, mcontext.GetOpUserID(ctx))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tips := &sdkws.MemberKickedTips{Group: group, OpUser: user}
|
||||
func (g *GroupNotificationSender) MemberKickedNotification(ctx context.Context, tips *sdkws.MemberKickedTips) (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, tips.GroupID)
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//user, err := g.getGroupMember(ctx, tips.GroupID, mcontext.GetOpUserID(ctx))
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
//tips := &sdkws.MemberKickedTips{Group: group, OpUser: user}
|
||||
//for _, v := range kickedUserIDList {
|
||||
// var groupMemberInfo sdkws.GroupMemberFullInfo
|
||||
// if err := c.setGroupMemberInfo(ctx, req.GroupID, v, &groupMemberInfo); err != nil {
|
||||
// if err := c.setGroupMemberInfo(ctx, tips.GroupID, v, &groupMemberInfo); err != nil {
|
||||
// continue
|
||||
// }
|
||||
// MemberKickedTips.KickedUserList = append(MemberKickedTips.KickedUserList, &groupMemberInfo)
|
||||
//}
|
||||
return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), group.GroupID, constant.MemberKickedNotification, tips)
|
||||
return g.msgClient.Notification(ctx, mcontext.GetOpUserID(ctx), tips.Group.GroupID, constant.MemberKickedNotification, tips)
|
||||
}
|
||||
|
||||
func (g *GroupNotificationSender) MemberInvitedNotification(ctx context.Context, groupID, reason string, invitedUserIDList []string) (err error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user