Weixin/Model/Remote/_webwxstatusnotify.pm

filter: Statementstmt 21.0% 4 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 33.3% 1 / 3 Podpod n/a totaltotal 11.6% 5 / 43 CC 7 SCAR 37.8
CC
7
Cov
12%
_webwxstatusnotify
56.0
__ANON__
2.0
BEGIN
1.0
CRAP 43.9
« Weixin/Run.pm ↑ Summary Weixin/Plugin/PostQRcodeToTelegram.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 0 ▶sub Mojo::Weixin::_webwxstatusnotify {
Subroutine _webwxstatusnotify: not called CC=7 SCAR=40.3
3 0 my $self = shift;
4 0 my $id = shift;
5 0 ▶ my $code = shift || 3;
Condition0%0/2
shift() || 3
l!l
00
MC/DC0%0/1
shift() || 3
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
6 0 $self->debug("发送状态通知...");
7 0 my $api = "https://". $self->domain . "/cgi-bin/mmwebwx-bin/webwxstatusnotify";
8 0 ▶ my @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
9 my $post = {
10 BaseRequest => {
11 Uin => $self->wxuin,
12 Sid => $self->wxsid,
13 Skey => $self->skey,
14 DeviceID => $self->deviceid,
15 },
16 0 ▶ ClientMsgId => sub{my $r = sprintf "%.3f", rand();$r=~s/\.//g;return $self->now() . $r;}->(),
Subroutine __ANON__: not called CC=1 SCAR=6.9
Condition0%0/3
$id || $self->user->id
l!l&&r!l&&!r
000
MC/DC0%0/2
$id || $self->user->id
$id $self->user->id
Truth table0%0/3
A || B
A= $idB= $self->user->id
ABresult
1X1
011
000
17 Code => $code,
18 FromUserName => $self->user->id,
19 ToUserName => $id || $self->user->id,
20 };
21  
22 0 my $json = $self->http_post($self->gen_url($api,@query_string),{json=>1,Referer=>'https://' . $self->domain . '/'},json=>$post);
23 0 ▶ if(not defined $json or (defined $json and $json->{BaseResponse}{Ret}!=0)){
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $json or defined $json and $json->{"BaseResponse"}{"Ret"} != 0) 0 0 0
Condition0%0/6
not defined $json or defined $json and $json->{"BaseResponse"}{"Ret"} != 0
l!l&&r!l&&!r
000
defined $json and $json->{"BaseResponse"}{"Ret"} != 0
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $json or defined $json and $json->{"BaseResponse"}{"Ret"} != 0
not defined $json defined $json $json->{"BaseResponse"}{"Ret"} != 0
Truth table0%0/4
not(A) or B and C
A= not defined $jsonB= defined $jsonC= $json->{"BaseResponse"}{"Ret"} != 0
ABCresult
1XX1
0111
00X0
0100
24 0 $self->warn("发送状态通知失败");
25 0 return;
26 }
27 0 return 1;
28 }
29 1 1;
« Weixin/Run.pm ↑ Summary Weixin/Plugin/PostQRcodeToTelegram.pm »