Browse Source

update

master
DengBiao 1 year ago
parent
commit
7b3db6924f
1 changed files with 15 additions and 13 deletions
  1. +15
    -13
      internal/logic/domain/group/repo/group_repo.go

+ 15
- 13
internal/logic/domain/group/repo/group_repo.go View File

@@ -2,6 +2,7 @@ package repo

import (
"gim/internal/logic/domain/group/model"
"strconv"
)

type groupRepo struct{}
@@ -37,16 +38,15 @@ func (*groupRepo) Get(groupId int64) (*model.Group, error) {

// GetLimit 获取群组信息(限量)
func (*groupRepo) GetLimit(groupId, limit int64) (*model.Group, error) {
//group, err := GroupCache.GetLimit(strconv.FormatInt(limit, 10), groupId)
//if err != nil {
// return nil, err
//}
//if group != nil {
// return group, nil
//}
var group *model.Group
group, err := GroupCache.GetLimit(strconv.FormatInt(limit, 10), groupId)
if err != nil {
return nil, err
}
if group != nil {
return group, nil
}

group, err := GroupDao.Get(groupId)
group, err = GroupDao.Get(groupId)
if err != nil {
return nil, err
}
@@ -56,10 +56,12 @@ func (*groupRepo) GetLimit(groupId, limit int64) (*model.Group, error) {
}
group.Members = members

//err = GroupCache.SetLimit(strconv.FormatInt(limit, 10), group)
//if err != nil {
// return nil, err
//}
if len(members) == int(limit) {
err = GroupCache.SetLimit(strconv.FormatInt(limit, 10), group)
if err != nil {
return nil, err
}
}
return group, nil
}



Loading…
Cancel
Save