line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4
|
use JSON; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
2
|
1
|
|
|
1
|
|
80
|
use Webqq::Client::Util qw(console); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
317
|
|
3
|
|
|
|
|
|
|
sub Webqq::Client::get_qq_from_uin{ |
4
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
5
|
0
|
|
|
|
|
|
my $uin = shift; |
6
|
0
|
|
|
|
|
|
my $cache_data = $self->{cache_for_uin_to_qq}->retrieve($uin); |
7
|
0
|
0
|
|
|
|
|
return $cache_data if defined $cache_data; |
8
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
9
|
0
|
|
|
|
|
|
my $api_url = 'http://s.web2.qq.com/api/get_friend_uin2'; |
10
|
0
|
0
|
|
|
|
|
my @headers = $self->{type} eq 'webqq'? (Referer=>'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3') |
11
|
|
|
|
|
|
|
: (Referer=>'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1') |
12
|
|
|
|
|
|
|
; |
13
|
0
|
|
|
|
|
|
my @query_string = ( |
14
|
|
|
|
|
|
|
tuin => $uin, |
15
|
|
|
|
|
|
|
type => 1, |
16
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
17
|
|
|
|
|
|
|
t => time, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
if($self->{type} eq 'webqq'){ |
21
|
0
|
|
|
|
|
|
@query_string=( |
22
|
|
|
|
|
|
|
tuin => $uin, |
23
|
|
|
|
|
|
|
verifysession => undef, |
24
|
|
|
|
|
|
|
type => 1, |
25
|
|
|
|
|
|
|
code => undef, |
26
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
27
|
|
|
|
|
|
|
t => time, |
28
|
|
|
|
|
|
|
) |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my @query_string_pairs; |
32
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); |
33
|
0
|
|
|
|
|
|
my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); |
34
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
35
|
0
|
0
|
|
|
|
|
print $response->content(),"\n" if $self->{debug}; |
36
|
0
|
|
|
|
|
|
my $json = JSON->new->utf8->decode( $response->content() ); |
37
|
0
|
0
|
|
|
|
|
if($json->{retcode} !=0){ |
38
|
0
|
|
|
|
|
|
console "从指定uin: $uin 查询QQ号码失败\n"; |
39
|
0
|
|
|
|
|
|
return undef; |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
$self->{cache_for_uin_to_qq}->store($uin,$json->{result}{account}); |
42
|
0
|
|
|
|
|
|
return $json->{result}{account}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
1; |