GetUID 获取缓存中对应uin的uid
(uin uint32, groupUin ...uint32)
| 8 | |
| 9 | // GetUID 获取缓存中对应uin的uid |
| 10 | func (c *QQClient) GetUID(uin uint32, groupUin ...uint32) string { |
| 11 | if uin == 0 { |
| 12 | return "" |
| 13 | } |
| 14 | if len(groupUin) == 0 && c.cache.FriendCacheIsEmpty() { |
| 15 | if err := c.RefreshFriendCache(); err != nil { |
| 16 | return "" |
| 17 | } |
| 18 | } else if len(groupUin) != 0 && c.cache.GroupMemberCacheIsEmpty(groupUin[0]) { |
| 19 | if err := c.RefreshGroupMembersCache(groupUin[0]); err != nil { |
| 20 | return "" |
| 21 | } |
| 22 | } |
| 23 | if uid := c.cache.GetUID(uin, groupUin...); uid != "" { |
| 24 | return uid |
| 25 | } |
| 26 | if len(groupUin) == 0 { |
| 27 | _ = c.RefreshFriendCache() |
| 28 | } else { |
| 29 | _ = c.RefreshGroupMembersCache(groupUin[0]) |
| 30 | } |
| 31 | return c.cache.GetUID(uin, groupUin...) |
| 32 | } |
| 33 | |
| 34 | // GetUin 获取缓存中对应的uin |
| 35 | func (c *QQClient) GetUin(uid string, groupUin ...uint32) uint32 { |
no test coverage detected