From 7aac55987ae1981b4ede44c9a5bdcbab3671fe56 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 7 Apr 2023 17:53:43 +0800 Subject: [PATCH] update --- internal/logic/domain/group/model/group.go | 30 +++++++++++++++------- pkg/urlwhitelist/urlwhitelist.go | 6 ++++- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index a6a5364..e19f46a 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -494,7 +494,7 @@ func (g *Group) PushGroupMemberBanned(ctx context.Context, optId, userId int64, if err != nil { return err } - if !isAllMemberBanned { + if !isAllMemberBanned && userId > 0 { bannedUserResp, err := rpc.GetBusinessIntClient().GetUser(ctx, &pb.GetUserReq{UserId: userId}) if err != nil { return err @@ -510,14 +510,26 @@ func (g *Group) PushGroupMemberBanned(ctx context.Context, optId, userId int64, } return nil } else { - err = g.PushMessage(ctx, pb.PushCode_PC_BANNED_GROUP_MEMBER, &pb.BannedGroupMemberPush{ - OptId: optId, - OptName: userResp.User.Nickname, - BannedUserId: userId, - BannedUserName: fmt.Sprintf("管理员\"%s\"设置了禁言", userResp.User.Nickname), - }, true) - if err != nil { - return err + if userId == 0 { + err = g.PushMessage(ctx, pb.PushCode_PC_BANNED_GROUP_MEMBER, &pb.BannedGroupMemberPush{ + OptId: optId, + OptName: userResp.User.Nickname, + BannedUserId: userId, + BannedUserName: fmt.Sprintf("管理员\"%s\"设置群禁言", userResp.User.Nickname), + }, true) + if err != nil { + return err + } + } else { + err = g.PushMessage(ctx, pb.PushCode_PC_BANNED_GROUP_MEMBER, &pb.BannedGroupMemberPush{ + OptId: optId, + OptName: userResp.User.Nickname, + BannedUserId: userId, + BannedUserName: fmt.Sprintf("管理员\"%s\"取消群禁言", userResp.User.Nickname), + }, true) + if err != nil { + return err + } } return nil } diff --git a/pkg/urlwhitelist/urlwhitelist.go b/pkg/urlwhitelist/urlwhitelist.go index 2aab7c4..9c2a13a 100644 --- a/pkg/urlwhitelist/urlwhitelist.go +++ b/pkg/urlwhitelist/urlwhitelist.go @@ -8,5 +8,9 @@ var Business = map[string]int{ } var Logic = map[string]int{ - "/pb.LogicExt/RegisterDevice": 0, + "/pb.LogicExt/RegisterDevice": 0, + "/pb.LogicExt/GetGroup": 1, + "/pb.LogicExt/GetGroupBannedMembers": 2, + "/pb.LogicExt/SetGroupBannedMembers": 3, + "/pb.LogicExt/SendMessage": 4, }