From 37c068a882eaa0bd1622e0f86bc618bf119eecf0 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 24 Apr 2023 11:21:07 +0800 Subject: [PATCH] update --- internal/logic/domain/group/repo/group_cache.go | 4 ++-- internal/logic/domain/group/repo/group_repo.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/logic/domain/group/repo/group_cache.go b/internal/logic/domain/group/repo/group_cache.go index 26278ec..635b307 100644 --- a/internal/logic/domain/group/repo/group_cache.go +++ b/internal/logic/domain/group/repo/group_cache.go @@ -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) } diff --git a/internal/logic/domain/group/repo/group_repo.go b/internal/logic/domain/group/repo/group_repo.go index c598e02..0af02ee 100644 --- a/internal/logic/domain/group/repo/group_repo.go +++ b/internal/logic/domain/group/repo/group_repo.go @@ -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 }