line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
sub Mojo::Webqq::Model::get_qq_from_id{ |
2
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
3
|
0
|
|
|
|
|
|
return ; |
4
|
0
|
|
|
|
|
|
my $uin = shift; |
5
|
0
|
|
|
|
|
|
my $cache_data = $self->id_to_qq_cache->retrieve($uin); |
6
|
0
|
0
|
|
|
|
|
return $cache_data if defined $cache_data; |
7
|
0
|
|
|
|
|
|
my $api_url = 'http://s.web2.qq.com/api/get_friend_uin2'; |
8
|
0
|
|
|
|
|
|
my $headers = {Referer=>'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',json=>1}; |
9
|
0
|
|
|
|
|
|
my @query_string = ( |
10
|
|
|
|
|
|
|
tuin => $uin, |
11
|
|
|
|
|
|
|
type => 1, |
12
|
|
|
|
|
|
|
vfwebqq => $self->vfwebqq, |
13
|
|
|
|
|
|
|
t => time, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $json = $self->http_get($self->gen_url($api_url,@query_string),$headers); |
17
|
0
|
0
|
|
|
|
|
return undef unless defined $json; |
18
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode} !=0; |
19
|
0
|
|
|
|
|
|
$self->id_to_qq_cache->store($uin,$json->{result}{account}); |
20
|
0
|
|
|
|
|
|
return $json->{result}{account}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
1; |