Weixin/Model/Remote/_webwxbatchgetcontact_friend.pm

filter: Statementstmt 25.0% 7 / 28 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 19.5% 9 / 46 CC 10 SCAR 45.2
CC
10
Cov
17%
_webwxbatchgetcontact_friend
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 91.8
« Weixin/Plugin/ShowMsg.pm ↑ Summary Weixin/Message.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Mojo::Weixin::Const qw(%KEY_MAP_FRIEND);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶sub Mojo::Weixin::_webwxbatchgetcontact_friend{
Subroutine _webwxbatchgetcontact_friend: not called CC=10 SCAR=47.0
4 0 my $self = shift;
5 0 my @ids = @_;
6 0 my @return;
7 0 my $api = "https://".$self->domain . "/cgi-bin/mmwebwx-bin/webwxbatchgetcontact";
8  
9 0 ▶ while( my @id = splice(@ids,0,50) ){
Branch: 1 branch
BranchTrueFalseTotal
if (my(@id) = splice(@ids, 0, 50)) 0 0 0
10 0 my @query_string = (
11 type => "ex",
12 r => $self->now(),
13 );
14 0 ▶ push @query_string,(pass_ticket => $self->pass_ticket) if $self->pass_ticket;
Branch: 1 branch
BranchTrueFalseTotal
if $self->pass_ticket 0 0 0
15 my $post = {
16 BaseRequest => {
17 Uin => $self->wxuin,
18 DeviceID => $self->deviceid,
19 Sid => $self->wxsid,
20 Skey => $self->skey,
21 },
22 Count => @id+0,
23 0 List => [ map { {UserName=>$_,EncryChatRoomId=>""} } @id ],
24 };
25 0 my $json = $self->http_post($self->gen_url2($api,@query_string),{Referer=>'https://'.$self->domain . '/',json=>1},json=>$post);
26 0 ▶ next unless defined $json;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $json 0 0 0
27 0 ▶ next if $json->{BaseResponse}{Ret}!=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"BaseResponse"}{"Ret"} != 0 0 0 0
28 0 for my $e (@{$json->{ContactList}}){
29 0 my $friend = {};
30 0 for(keys %KEY_MAP_FRIEND){
31 0 ▶ $friend->{$_} = $e->{$KEY_MAP_FRIEND{$_}} // "";
Condition0%0/2
$$e{$Mojo::Weixin::Model::KEY_MAP_FRIEND{$_}} // ""
l!l
00
MC/DC0%0/1
$$e{$Mojo::Weixin::Model::KEY_MAP_FRIEND{$_}} // ""
$$e{$Mojo::Weixin::Model::KEY_MAP_FRIEND{$_}}
Truth table0%0/2
A
A= $$e{$Mojo::Weixin::Model::KEY_MAP_FRIEND{$_}}
Aresult
11
00
32 }
33 0 $friend->{sex} = $self->code2sex($friend->{sex});
34 0 push @return,$friend;
35 }
36  
37 }
38 0 ▶ return if @return ==0;
Branch: 1 branch
BranchTrueFalseTotal
if @return == 0 0 0 0
39 0 ▶ return wantarray?@return:$return[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
40 }
41  
42 1 1;
« Weixin/Plugin/ShowMsg.pm ↑ Summary Weixin/Message.pm »