| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 23 | 0 | ▶ | print $response->content,"\n" if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | my $json = JSON->new->utf8->decode($response->content); | |||||||||
| 25 | 0 | ▶ | if($json->{retcode}!=0){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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; | |||||||||