Weixin/Model/Remote/_webwxbatchgetcontact_group.pm

filter: Statementstmt 18.5% 10 / 54 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 14.7% 13 / 88 CC 20 SCAR 59.0
CC
20
Cov
12%
_webwxbatchgetcontact_group
420.0
BEGIN
1.0
BEGIN
1.0
CRAP 365.3
« Weixin/Plugin/SmartReply.pm ↑ Summary Weixin/Util.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Mojo::Weixin::Const qw(%KEY_MAP_GROUP %KEY_MAP_GROUP_MEMBER);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Mojo::Weixin::Model::Remote::_webwxbatchgetcontact_group_member;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶sub Mojo::Weixin::_webwxbatchgetcontact_group{
Subroutine _webwxbatchgetcontact_group: not called CC=20 SCAR=60.4
5 0 my $self = shift;
6 0 ▶ my $is_update_group_member_detail = shift // 1;
Condition0%0/2
shift() // 1
l!l
00
MC/DC0%0/1
shift() // 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
7 0 my @ids = @_;
8 0 my @return;
9 0 my $api = "https://".$self->domain . "/cgi-bin/mmwebwx-bin/webwxbatchgetcontact";
10  
11 0 ▶ while( my @id = splice(@ids,0,50) ){
Branch: 1 branch
BranchTrueFalseTotal
if (my(@id) = splice(@ids, 0, 50)) 0 0 0
12 0 my @query_string = (
13 type => "ex",
14 r => $self->now(),
15 );
16 0 ▶ push @query_string,(pass_ticket => $self->pass_ticket) if $self->pass_ticket;
Branch: 1 branch
BranchTrueFalseTotal
if $self->pass_ticket 0 0 0
17 my $post = {
18 BaseRequest => {
19 Uin => $self->wxuin,
20 DeviceID => $self->deviceid,
21 Sid => $self->wxsid,
22 Skey => $self->skey,
23 },
24 Count => @id+0,
25 0 List => [ map { {UserName=>$_,ChatRoomId=>""} } @id ],
26 };
27 0 my $json = $self->http_post($self->gen_url2($api,@query_string),{Referer=>'https://'.$self->domain . '/',json=>1},json=>$post);
28 0 ▶ next unless defined $json;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $json 0 0 0
29 0 ▶ next if $json->{BaseResponse}{Ret}!=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"BaseResponse"}{"Ret"} != 0 0 0 0
30 0 for my $e (@{$json->{ContactList}}){
31 0 ▶ next if not $self->is_group_id($e->{UserName});
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_group_id($e->{"UserName"}) 0 0 0
32 0 my $group = {};
33 0 for(keys %KEY_MAP_GROUP){
34 0 ▶ $group->{$_} = $e->{$KEY_MAP_GROUP{$_}} // "";
Condition0%0/2
$$e{$Mojo::Weixin::Model::KEY_MAP_GROUP{$_}} // ""
l!l
00
MC/DC0%0/1
$$e{$Mojo::Weixin::Model::KEY_MAP_GROUP{$_}} // ""
$$e{$Mojo::Weixin::Model::KEY_MAP_GROUP{$_}}
Truth table0%0/2
A
A= $$e{$Mojo::Weixin::Model::KEY_MAP_GROUP{$_}}
Aresult
11
00
35 }
36 0 ▶ if($is_update_group_member_detail){
Branch: 1 branch
BranchTrueFalseTotal
if ($is_update_group_member_detail) { } 0 0 0
37 0 my @member = $self->_webwxbatchgetcontact_group_member($group->{_eid},map {$_->{UserName}} @{$e->{MemberList}});
38 0 ▶ if(@member){
Branch: 1 branch
BranchTrueFalseTotal
if (@member) { } 0 0 0
39 0 $group->{member} = \@member;
40 }
41 else{
42 0 for my $m (@{$e->{MemberList}}){
43 0 my $member = {};
44 0 for(keys %KEY_MAP_GROUP_MEMBER){
45 0 ▶ $member->{$_} = $m->{$KEY_MAP_GROUP_MEMBER{$_}} // "";
Condition0%0/2
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}} // ""
l!l
00
MC/DC0%0/1
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}} // ""
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}}
Truth table0%0/2
A
A= $$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}}
Aresult
11
00
46 }
47 0 $member->{sex} = $self->code2sex($member->{sex});
48 0 push @{$group->{member}},$member;
49 }
50 }
51 }
52 else{
53 0 for my $m (@{$e->{MemberList}}){
54 0 my $member = {};
55 0 for(keys %KEY_MAP_GROUP_MEMBER){
56 0 ▶ $member->{$_} = $m->{$KEY_MAP_GROUP_MEMBER{$_}} // "";
Condition0%0/2
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}} // ""
l!l
00
MC/DC0%0/1
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}} // ""
$$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}}
Truth table0%0/2
A
A= $$m{$Mojo::Weixin::Model::KEY_MAP_GROUP_MEMBER{$_}}
Aresult
11
00
57 }
58 0 $member->{sex} = $self->code2sex($member->{sex});
59 0 push @{$group->{member}},$member;
60 }
61 }
62 0 push @return,$group;
63 }
64  
65 }
66 0 ▶ return if @return ==0;
Branch: 1 branch
BranchTrueFalseTotal
if @return == 0 0 0 0
67 0 ▶ return wantarray?@return:$return[0];
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
68 }
69  
70 1 1;
« Weixin/Plugin/SmartReply.pm ↑ Summary Weixin/Util.pm »