|
|
@@ -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 |
|
|
|