Webqq/Client/Method/_get_vfwebqq.pm

filter: Statementstmt 25.9% 7 / 27 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 22.5% 9 / 40 CC 6 SCAR 34.6
CC
6
Cov
19%
_get_vfwebqq
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 31.8
« Webqq/Client/Method/_recv_message.pm ↑ Summary Webqq/Client/Method/_prepare_for_login.pm »
1 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Webqq::Client::Util qw(console);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶sub Webqq::Client::_get_vfwebqq {
Subroutine _get_vfwebqq: not called CC=6 SCAR=37.4
4 0 my $self = shift;
5 0 ▶ return 1 if $self->{type} ne 'smartqq';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} ne "smartqq" 0 0 0
6 0 console "获取vfwebqq值...\n";
7 0 my $api_url = 'http://s.web2.qq.com/api/getvfwebqq';
8 my @query_string = (
9 ptwebqq => $self->{qq_param}{ptwebqq},
10 clientid => $self->{qq_param}{clientid},
11 0 psessionid => undef,
12 t => rand(),
13 );
14 0 my @headers = (
15 Referer => 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
16 );
17 0 my @query_string_pairs;
18 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
19
20 0 my $ua = $self->{ua};
21 0 my $response = $ua->get($api_url . '?' .join("&",@query_string_pairs),@headers);
22 0 ▶ if($response->is_success){
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
23 0 ▶ print $response->content,"\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
24 0 my $json = JSON->new->utf8->decode($response->content);
25 0 ▶ if($json->{retcode}!=0){
Branch: 1 branch
BranchTrueFalseTotal
if ($json->{"retcode"} != 0) 0 0 0
26 0 console "获取vfwebqq值失败...\n";
27 0 return 0;
28 }
29 0 $self->{qq_param}{vfwebqq} = $json->{result}{vfwebqq};
30 0 return $json->{result}{vfwebqq};
31 }
32 else{
33 0 console "获取vfwebqq值失败...\n";
34 0 return 0;
35 }
36 }
37 1 1;
« Webqq/Client/Method/_recv_message.pm ↑ Summary Webqq/Client/Method/_prepare_for_login.pm »