| 1 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 0 | ▶ | sub Webqq::Client::_get_group_sig { | ||||||||
|
Subroutine
_get_group_sig: not called CC=8 SCAR=42.8
| |||||||||||
| 3 | 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 | ▶ | return $cache_data if defined $cache_data; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 7 | 0 | my $ua = $self->{ua}; | |||||||||
| 8 | 0 | my $api_url = 'http://d.web2.qq.com/channel/get_c2cmsg_sig2'; | |||||||||
| 9 | 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 | 0 | t => time, | |||||||||
| 16 | ); | ||||||||||
| 17 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer=>'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); | |||||||||
| 25 | 0 | ▶ | if($response->is_success){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | ▶ | print $response->content() if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | my $json = JSON->new->utf8->decode($response->content()); | |||||||||
| 28 | 0 | ▶ | return undef if $json->{retcode}!=0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | ▶ | return undef if $json->{result}{value} eq ""; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 0 | else{return undef} | |||||||||
| 34 | } | ||||||||||
| 35 | 1 | 1; | |||||||||