MCPcopy Create free account
hub / github.com/LagrangeDev/LagrangeGo / GetUin

Method GetUin

client/cache.go:35–58  ·  view source on GitHub ↗

GetUin 获取缓存中对应的uin

(uid string, groupUin ...uint32)

Source from the content-addressed store, hash-verified

33
34// GetUin 获取缓存中对应的uin
35func (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 获取好友信息(缓存)
61func (c *QQClient) GetCachedFriendInfo(uin uint32) *entity.User {

Callers 2

ResolveUinMethod · 0.95
FetchGroupInfoMethod · 0.95

Calls 4

RefreshFriendCacheMethod · 0.95
FriendCacheIsEmptyMethod · 0.80

Tested by

no test coverage detected