Weixin/Client/Remote/_is_need_login.pm

filter: Statementstmt 9.0% 1 / 11 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod n/a totaltotal 5.5% 1 / 18 CC 4 SCAR 30.0
CC
4
Cov
6%
_is_need_login
20.0
CRAP 20.0
« Weixin/Model/Remote/_webwxoplog_stick.pm ↑ Summary Weixin/Message/Remote/_send_text_message.pm »
1 0 ▶sub Mojo::Weixin::_is_need_login {
Subroutine _is_need_login: not called CC=4 SCAR=30.0
2 0 my $self = shift;
3 0 my $api = "https://". $self->domain ."/";
4 0 ▶ return 1 if $self->login_state eq "relogin";
Branch: 1 branch
BranchTrueFalseTotal
if $self->login_state eq "relogin" 0 0 0
5 0 $self->debug("检查登录Cookie是否有效...");
6 0 my $data = $self->http_get($api,{ua_debug_res_body=>0});
7 0 ▶ my $ret = $data=~/window\.MMCgi\s*=\s*{\s*isLogin\s*:\s*(!!"1")\s*}/s?0:1;
Branch: 1 branch
BranchTrueFalseTotal
$data =~ /window\.MMCgi\s*=\s*{\s*isLogin\s*:\s*(!!"1")\s*}/s ? : 0 0 0
8 0 ▶ if(not $ret){
Branch: 1 branch
BranchTrueFalseTotal
if (not $ret) { } 0 0 0
9 0 $self->debug("登录cookie仍然有效,可以免扫码登录");
10 }
11 else{
12 0 $self->debug("登录cookie不存在或已失效,需要扫码登录");
13 }
14 0 return $ret;
15 }
16 1 1;
« Weixin/Model/Remote/_webwxoplog_stick.pm ↑ Summary Weixin/Message/Remote/_send_text_message.pm »