line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use JSON; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
2
|
|
|
|
|
|
|
sub Webqq::Client::_get_group_sig { |
3
|
0
|
|
|
0
|
|
|
my $self = shift; |
4
|
0
|
|
|
|
|
|
my($id,$to_uin,$service_type,) = @_; |
5
|
0
|
|
|
|
|
|
my $cache_data = $self->{cache_for_group_sig}->retrieve("$id|$to_uin|$service_type"); |
6
|
0
|
0
|
|
|
|
|
return $cache_data if defined $cache_data; |
7
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
8
|
0
|
|
|
|
|
|
my $api_url = 'http://d.web2.qq.com/channel/get_c2cmsg_sig2'; |
9
|
0
|
|
|
|
|
|
my @query_string = ( |
10
|
|
|
|
|
|
|
id => $id, |
11
|
|
|
|
|
|
|
to_uin => $to_uin, |
12
|
|
|
|
|
|
|
service_type => $service_type, |
13
|
|
|
|
|
|
|
clientid => $self->{qq_param}{clientid}, |
14
|
|
|
|
|
|
|
psessionid => $self->{qq_param}{psessionid}, |
15
|
|
|
|
|
|
|
t => time, |
16
|
|
|
|
|
|
|
); |
17
|
0
|
0
|
|
|
|
|
my @headers = $self->{type} eq 'webqq'? (Referer=>'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') |
18
|
|
|
|
|
|
|
: (Referer=>'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2') |
19
|
|
|
|
|
|
|
; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my @query_string_pairs; |
23
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); |
24
|
0
|
|
|
|
|
|
my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); |
25
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
|
0
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
print $response->content() if $self->{debug}; |
27
|
0
|
|
|
|
|
|
my $json = JSON->new->utf8->decode($response->content()); |
28
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode}!=0; |
29
|
0
|
0
|
|
|
|
|
return undef if $json->{result}{value} eq ""; |
30
|
0
|
|
|
|
|
|
$self->{cache_for_group_sig}->store("$id|$to_uin|$service_type",$json->{result}{value},300); |
31
|
0
|
|
|
|
|
|
return $json->{result}{value} ; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else{return undef} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
1; |