| 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
| |||||||||||||||||||||
| 15 | 0 | ▶ | push @query_string,(pass_ticket => $self->url_escape($self->pass_ticket)) if $self->pass_ticket; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 25 | 0 | ▶ | elsif(defined $json and $json->{BaseResponse}{Ret} == -1){$status = 0} | ||||||||||||||||||
|
Condition0%0/3
defined $json and $json->{"BaseResponse"}{"Ret"} == -1
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
| |||||||||||||||||||||
| 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; | |||||||||||||||||||