GetUin 获取缓存中对应的uin
(uid string, groupUin ...uint32)
| 33 | |
| 34 | // GetUin 获取缓存中对应的uin |
| 35 | func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32 { |
| 36 | if uid == "" { |
| 37 | return 0 |
| 38 | } |
| 39 | if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() { |
| 40 | if err := c.RefreshFriendCache(); err != nil { |
| 41 | return 0 |
| 42 | } |
| 43 | } |
| 44 | if len(groupUin) != 0 && c.cache.GroupMemberCacheIsEmpty(groupUin[0]) { |
| 45 | if err := c.RefreshGroupMembersCache(groupUin[0]); err != nil { |
| 46 | return 0 |
| 47 | } |
| 48 | } |
| 49 | if uin := c.cache.GetUin(uid, groupUin...); uin != 0 { |
| 50 | return uin |
| 51 | } |
| 52 | if len(groupUin) == 0 { |
| 53 | _ = c.RefreshFriendCache() |
| 54 | } else { |
| 55 | _ = c.RefreshGroupMembersCache(groupUin[0]) |
| 56 | } |
| 57 | return c.cache.GetUin(uid, groupUin...) |
| 58 | } |
| 59 | |
| 60 | // GetCachedFriendInfo 获取好友信息(缓存) |
| 61 | func (c *QQClient) GetCachedFriendInfo(uin uint32) *entity.User { |
no test coverage detected