Webqq/Client/Method/_get_group_sig.pm

filter: Statementstmt 17.3% 4 / 23 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 12.8% 5 / 39 CC 8 SCAR 41.6
CC
8
Cov
11%
_get_group_sig
72.0
BEGIN
1.0
CRAP 64.1
« Webqq/Client/Method/_get_offpic.pm ↑ Summary Webqq/Client/Method/_get_recent_info.pm »
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
BranchTrueFalseTotal
if defined $cache_data 0 0 0
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
BranchTrueFalseTotal
$self->{'type'} eq 'webqq' ? : 0 0 0
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
BranchTrueFalseTotal
@query_string and do { push @query_string_pairs, shift(@query_string) . '=' . shift(@query_string) } 0 0 0
24 0 my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers);
25 0 ▶ if($response->is_success){
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
26 0 ▶ print $response->content() if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
27 0 my $json = JSON->new->utf8->decode($response->content());
28 0 ▶ return undef if $json->{retcode}!=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"retcode"} != 0 0 0 0
29 0 ▶ return undef if $json->{result}{value} eq "";
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"result"}{"value"} eq "" 0 0 0
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;
« Webqq/Client/Method/_get_offpic.pm ↑ Summary Webqq/Client/Method/_get_recent_info.pm »