Commit 2f46ebf5 authored by chenweijian's avatar chenweijian

隐藏的房间

parent 989d4dee
......@@ -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
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment