From 725e7fce68f7c66bebb1df832390edba94cf7c0b Mon Sep 17 00:00:00 2001 From: Redmomn <109732988+Redmomn@users.noreply.github.com> Date: Sat, 20 Apr 2024 09:49:35 +0800 Subject: [PATCH] fix: cache logic --- client/cache.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cache.go b/client/cache.go index 53b3f24c..72835a22 100644 --- a/client/cache.go +++ b/client/cache.go @@ -14,7 +14,7 @@ func (c *QQClient) GetUid(uin uint32, groupUin ...uint32) string { // GetUin 获取缓存中对应的uin func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32 { - if c.cache.FriendCacheIsEmpty() { + if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() { c.RefreshFriendCache() } if len(groupUin) != 0 && c.cache.GroupMemberCacheIsEmpty(groupUin[0]) { @@ -34,7 +34,7 @@ func (c *QQClient) GetCachedFriendInfo(uin uint32) *entity.Friend { // GetCachedGroupInfo 获取群信息(缓存) func (c *QQClient) GetCachedGroupInfo(groupUin uint32) *entity.Group { if c.cache.GroupInfoCacheIsEmpty() { - c.RefreshGroupMembersCache(groupUin) + c.RefreshAllGroupsInfo() } return c.cache.GetGroupInfo(groupUin) }