diff --git a/domain/model/group_m/groupSetting.go b/domain/model/group_m/groupSetting.go index 24e782d9efb50b9635385675267a8fa775215aff..fcb274cdb071df32f06e420bfc9758531426aa63 100644 --- a/domain/model/group_m/groupSetting.go +++ b/domain/model/group_m/groupSetting.go @@ -64,6 +64,20 @@ func IsHiddenGroup(db *gorm.DB, groupId string) (bool, error) { } } +func IsHiddenGroupBy(model *domain.Model, imGroupId string) bool { + info := new(GroupSetting) + if err := model.DB().Model(GroupSetting{}).Where("im_group_id = ? and is_hidden = 1", imGroupId).First(&info).Error; err != nil { + if err == gorm.ErrRecordNotFound { + return false + } + return false + } + if info != nil && info.ID > 0 { + return true + } + return false +} + func (gs *GroupSetting) Get(db *gorm.DB) error { return db.Where(gs).First(gs).Error } diff --git a/route/group_r/group_op.go b/route/group_r/group_op.go index f1d7d604e43b6867f8550aac8b21a03994b398cf..20bfa2753dfaae78b6993753b878e6a6351b67e6 100644 --- a/route/group_r/group_op.go +++ b/route/group_r/group_op.go @@ -882,6 +882,13 @@ func SearchGroup(c *gin.Context) (*mycontext.MyContext, error) { return myContext, nil } } + if group_m.IsHiddenGroupBy(model, g.ImGroupId) { + if flag, _ := user_m.IsSuperManager(model, myUserId); !flag { + // 被隐藏的用户,除了超管账户,其它用户搜索他的群组和个人ID,搜索结果为空 + resp.ResponsePageOk(c, result, uint(total), 1) + return myContext, nil + } + } supportLevels, err := group_s.NewGroupService(myContext).GetWeekMaxSupportLevelMap() if err != nil { return myContext, err