| 1 | sub Mojo::Webqq::Client::_check_login { | ||
| 2 | my $self = shift; | ||
| 3 | $self->info("正在检查登录状态..."); | ||
| 4 | if($self->search_cookie("supertoken") and $self->search_cookie("superuin")){ | ||
| 5 | my $content = $self->http_get('https://ssl.ptlogin2.qq.com/pt4_auth?daid=164&appid=501004106&auth_token=' . $self->time33($self->search_cookie("supertoken")), {Referer => 'https://xui.ptlogin2.qq.com/cgi-bin/xlogin?daid=164&target=self&style=40&pt_disable_pwd=1&mibao_css=m_webqq&appid=501004106&enable_qlogin=0&no_verifyimg=1&s_url=http%3A%2F%2F' . $self->domain . '%2Fproxy.html&f_url=loginerroralert&strong_login=1&login_state=10&t=20131024001'} ); | ||
| 6 | return 0 if not defined $content; | ||
| 7 | my( $retcode,$api_check_sig) = $content=~/'(.*?)'/g; | ||
| 8 | $self->info("登录状态检查结果($retcode)"); | ||
| 9 | if( $api_check_sig =~ /^https?:\/\/[^\/]+\.qq\.com\/check_sig/){ | ||
| 10 | $self->api_check_sig($api_check_sig . '®master=&aid=501004106&s_url=http%3A%2F%2F'. $self->domain . '%2Fproxy.html'); | ||
| 11 | $self->info("检查结果:登录状态有效,尝试直接恢复登录..."); | ||
| 12 | return 1; | ||
| 13 | } | ||
| 14 | else{ | ||
| 15 | $self->info("检查结果:需要重新登录(1)"); | ||
| 16 | return 0; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | else{ | ||
| 20 | $self->info("检查结果:需要重新登录(2)"); | ||
| 21 | return 0; | ||
| 22 | } | ||
| 23 | } | ||
| 24 | 1; |