| 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::_login2{ | ||||||||
|
Subroutine
_login2: not called CC=7 SCAR=40.3
| |||||||||||
| 4 | 0 | my $self = shift; | |||||||||
| 5 | 0 | console "尝试进行登录(阶段2)...\n"; | |||||||||
| 6 | 0 | my $ua = $self->{ua}; | |||||||||
| 7 | 0 | my $api_url = 'http://d.web2.qq.com/channel/login2'; | |||||||||
| 8 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer=>'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 9 | : (Referer=>'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2') | ||||||||||
| 10 | ; | ||||||||||
| 11 | my %r = ( | ||||||||||
| 12 | status => $self->{qq_param}{state}, | ||||||||||
| 13 | ptwebqq => $self->{qq_param}{ptwebqq}, | ||||||||||
| 14 | clientid => $self->{qq_param}{clientid}, | ||||||||||
| 15 | psessionid => $self->{qq_param}{psessionid}, | ||||||||||
| 16 | 0 | ); | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | if($self->{type} eq 'webqq'){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | $r{passwd_sig} = $self->{qq_param}{passwd_sig}; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 0 | ▶ | for(my $i=0;$i<=$self->{ua_retry_times};$i++){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)], @headers); | |||||||||
| 24 | 0 | ▶ | if($response->is_success){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | ▶ | print $response->content() if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 0 | my $content = $response->content(); | |||||||||
| 27 | 0 | my $data = JSON->new->utf8->decode($content); | |||||||||
| 28 | 0 | ▶ | if($data->{retcode} ==0){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | $self->{qq_param}{psessionid} = $data->{result}{psessionid}; | |||||||||
| 30 | #$self->{qq_param}{vfwebqq} = $data->{result}{vfwebqq}; | ||||||||||
| 31 | 0 | $self->_cookie_proxy(); | |||||||||
| 32 | 0 | $self->{login_state} = 'success'; | |||||||||
| 33 | 0 | return 1; | |||||||||
| 34 | } | ||||||||||
| 35 | } | ||||||||||
| 36 | } | ||||||||||
| 37 | 0 | return 0; | |||||||||
| 38 | } | ||||||||||
| 39 | 1 | 1; | |||||||||