Skip to content

Commit

Permalink
🐛 fix: 优化缓存获取逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Jan 4, 2025
1 parent 237c559 commit 02a61d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import (

// GetUID 获取缓存中对应uin的uid
func (c *QQClient) GetUID(uin uint32, groupUin ...uint32) string {
if uin == 0 {
return ""
}
if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() {
if err := c.RefreshFriendCache(); err != nil {
return ""
Expand All @@ -30,6 +33,9 @@ func (c *QQClient) GetUID(uin uint32, groupUin ...uint32) string {

// GetUin 获取缓存中对应的uin
func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32 {
if uid == "" {
return 0
}
if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() {
if err := c.RefreshFriendCache(); err != nil {
return 0
Expand Down

0 comments on commit 02a61d1

Please sign in to comment.