Weixin/Client/Remote/_sync.pm

filter: Statementstmt 5.2% 1 / 19 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 2.9% 1 / 34 CC 6 SCAR 28.1
CC
6
Cov
3%
__ANON__
20.0
_sync
12.0
CRAP 16.6
« Weixin/Message/Remote/_send_text_message.pm ↑ Summary Weixin/Plugin/UploadQRcode2.pm »
1 0 ▶sub Mojo::Weixin::_sync {
Subroutine _sync: not called CC=3 SCAR=24.8
2 0 my $self = shift;
3 #if($self->_synccheck_running or $self->_sync_running){
4 #if($self->_sync_running){
5 # $self->debug("消息处理程序进行中,避免重复运行(2)");
6 # return;
7 #}
8 0 $self->debug("接收消息...");
9 0 $self->_sync_running(1);
10 0 my $api = 'https://'. $self->domain . '/cgi-bin/mmwebwx-bin/webwxsync';
11 0 my @query_string = (
12 sid => $self->wxsid,
13 );
14 0 ▶ push @query_string,(skey => $self->skey) if $self->skey;
Branch: 1 branch
BranchTrueFalseTotal
if $self->skey 0 0 0
15 0 ▶ push @query_string,(pass_ticket => $self->url_escape($self->pass_ticket)) if $self->pass_ticket;
Branch: 1 branch
BranchTrueFalseTotal
if $self->pass_ticket 0 0 0
16 0 my $post = {
17 BaseRequest => {Uin => $self->wxuin,Sid=>$self->wxsid,},
18 SyncKey => $self->sync_key,
19 rr => $self->now(),
20 };
21 0 ▶ my $callback = sub{
Subroutine __ANON__: not called CC=4 SCAR=30.0
22 0 my ($json,$ua,$tx) = @_;
23 0 my $status = 1;
24 0 ▶ if(not defined $json){$status = 0;}
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $json) { } 0 0 0
elsif (defined $json and $json->{'BaseResponse'}{'Ret'} == -1) { } 0 0 0
25 0 ▶ elsif(defined $json and $json->{BaseResponse}{Ret} == -1){$status = 0}
Condition0%0/3
defined $json and $json->{"BaseResponse"}{"Ret"} == -1
!ll&&!rl&&r
000
MC/DC0%0/2
defined $json and $json->{"BaseResponse"}{"Ret"} == -1
defined $json $json->{"BaseResponse"}{"Ret"} == -1
Truth table0%0/3
A and B
A= defined $jsonB= $json->{"BaseResponse"}{"Ret"} == -1
ABresult
0X0
100
111
26 0 $self->_sync_running(0);
27 0 $self->emit(receive_raw_message=>$tx->res->body,$json);
28 0 $self->emit("sync_over",$json,$status);
29 0 };
30 0 $self->http_post($self->gen_url($api,@query_string),{Referer=>'https://' . $self->domain . '/',json=>1},json=>$post,$callback);
31 }
32 1 1;
« Weixin/Message/Remote/_send_text_message.pm ↑ Summary Weixin/Plugin/UploadQRcode2.pm »