Skip to content

Commit

Permalink
fix: get uin from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Apr 17, 2024
1 parent 1bd25c8 commit 84ef568
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion client/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@ import (
"github.com/LagrangeDev/LagrangeGo/entity"
)

// GetUid 获取缓存中对应qq的uid,仅限好友
// GetUid 获取缓存中对应uin的uid
func (c *QQClient) GetUid(uin uint32, groupUin ...uint32) string {
if c.cache.FriendCacheIsEmpty() {
c.RefreshFriendCache()
}
return c.cache.GetUid(uin, groupUin...)
}

// GetUin 获取缓存中对应的uin
func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32 {
if c.cache.FriendCacheIsEmpty() {
c.RefreshFriendCache()
}
if len(groupUin) != 0 && c.cache.GroupMemberCacheIsEmpty(groupUin[0]) {
c.RefreshGroupMembersCache(groupUin[0])
}
return c.cache.GetUin(uid, groupUin...)
}

// GetFriendInfo 获取好友信息
func (c *QQClient) GetFriendInfo(uin uint32) *entity.Friend {
if c.cache.FriendCacheIsEmpty() {
Expand Down

0 comments on commit 84ef568

Please sign in to comment.