From 8ac443e72dd6780e6167560c23e77e3f1698d413 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sat, 10 Jun 2023 12:24:29 +0800 Subject: [PATCH] update --- internal/logic/app/group_app.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/internal/logic/app/group_app.go b/internal/logic/app/group_app.go index 61a067a..6a9cf05 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/app/group_app.go @@ -5,7 +5,6 @@ import ( "database/sql" "errors" "gim/internal/business/comm/utils" - repo2 "gim/internal/business/domain/user/repo" "gim/internal/logic/domain/group/model" "gim/internal/logic/domain/group/repo" "gim/pkg/db" @@ -72,10 +71,10 @@ func (*groupApp) GetUserGroups(ctx context.Context, userId int64) ([]*pb.Group, if err != nil { return nil, err } - user, err := repo2.UserRepo.Get(userId) - if err != nil { - return nil, err - } + //user, err := repo2.UserRepo.Get(userId) + //if err != nil { + // return nil, err + //} groups, err := repo.GroupUserRepo.ListByUserId(userId) if err != nil { @@ -85,8 +84,17 @@ func (*groupApp) GetUserGroups(ctx context.Context, userId int64) ([]*pb.Group, pbGroups := make([]*pb.Group, len(groups)) for i := range groups { pbGroups[i] = groups[i].ToProto() - if !strings.Contains(pbGroups[i].Introduction, user.PhoneNumber) && !strings.Contains(pbGroups[i].Name, "官方") && !strings.Contains(pbGroups[i].Name, "运营中心") && masterId == "68823769" { - pbGroups[i].Name = "我的推荐人群" + //if !strings.Contains(pbGroups[i].Introduction, user.PhoneNumber) && !strings.Contains(pbGroups[i].Name, "官方") && !strings.Contains(pbGroups[i].Name, "运营中心") && masterId == "68823769" { + // pbGroups[i].Name = "我的推荐人群" + //} + groupUser, err := repo.GroupUserRepo.Get(pbGroups[i].GroupId, userId) + if err != nil { + return nil, err + } + if !strings.Contains(pbGroups[i].Name, "官方") && !strings.Contains(pbGroups[i].Name, "运营中心") && masterId == "68823769" { + if groupUser.MemberType != int(pb.MemberType_GMT_ADMIN) { + pbGroups[i].Name = "我的推荐人群" + } } } return pbGroups, nil