Bläddra i källkod

update

master
DengBiao 1 år sedan
förälder
incheckning
37c068a882
2 ändrade filer med 5 tillägg och 5 borttagningar
  1. +2
    -2
      internal/logic/domain/group/repo/group_cache.go
  2. +3
    -3
      internal/logic/domain/group/repo/group_repo.go

+ 2
- 2
internal/logic/domain/group/repo/group_cache.go Visa fil

@@ -32,7 +32,7 @@ func (c *groupCache) Get(groupId int64) (*model.Group, error) {
// GetLimit 获取群组缓存
func (c *groupCache) GetLimit(limit string, groupId int64) (*model.Group, error) {
var user model.Group
err := db.RedisUtil.Get(GroupKey+limit+strconv.FormatInt(groupId, 10), &user)
err := db.RedisUtil.Get(GroupKey+limit+":"+strconv.FormatInt(groupId, 10), &user)
if err != nil && err != redis.Nil {
return nil, gerrors.WrapError(err)
}
@@ -53,7 +53,7 @@ func (c *groupCache) Set(group *model.Group) error {

// SetLimit 设置群组缓存
func (c *groupCache) SetLimit(limit string, group *model.Group) error {
err := db.RedisUtil.Set(GroupKey+limit+strconv.FormatInt(group.Id, 10), group, 24*time.Hour)
err := db.RedisUtil.Set(GroupKey+limit+":"+strconv.FormatInt(group.Id, 10), group, 24*time.Hour)
if err != nil {
return gerrors.WrapError(err)
}


+ 3
- 3
internal/logic/domain/group/repo/group_repo.go Visa fil

@@ -1,8 +1,8 @@
package repo

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

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

// GetLimit 获取群组信息(限量)
func (*groupRepo) GetLimit(groupId, limit int64) (*model.Group, error) {
group, err := GroupCache.GetLimit(utils.Int64ToStr(limit), groupId)
group, err := GroupCache.GetLimit(strconv.FormatInt(limit, 10), groupId)
if err != nil {
return nil, err
}
@@ -56,7 +56,7 @@ func (*groupRepo) GetLimit(groupId, limit int64) (*model.Group, error) {
}
group.Members = members

err = GroupCache.SetLimit(utils.Int64ToStr(limit), group)
err = GroupCache.SetLimit(strconv.FormatInt(limit, 10), group)
if err != nil {
return nil, err
}


Laddar…
Avbryt
Spara