| 1 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 0 | ▶ | sub Mojo::Webqq::Model::_get_group_info_ext { | ||||||||||||||||||||||||||
|
Subroutine
_get_group_info_ext: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 3 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 4 | 0 | my $uid = shift; | |||||||||||||||||||||||||||
| 5 | 0 | my $callback = shift; | |||||||||||||||||||||||||||
| 6 | #my $api = "http://qinfo.clt.qq.com/cgi-bin/qun_info/get_group_members_new"; | ||||||||||||||||||||||||||||
| 7 | 0 | my $api = "http://qinfo.clt.qq.com/cgi-bin/qun_info/get_group_members"; | |||||||||||||||||||||||||||
| 8 | 0 | ▶ | my $is_blocking = ref $callback eq "CODE"?0:1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 9 | 0 | ▶ | my $handle = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=17 SCAR=57.2
| |||||||||||||||||||||||||||||
| 10 | 0 | my $json = shift; | |||||||||||||||||||||||||||
| 11 | 0 | ▶ | return if not defined $json; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | return if $json->{ec}!=0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | if(ref $json->{mems} ne 'ARRAY'){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | 0 | $self->warn("更新群[$uid]扩展信息失败: 返回数据异常"); | |||||||||||||||||||||||||||
| 15 | 0 | return; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | 0 | my %levelname; | |||||||||||||||||||||||||||
| 18 | 0 | for(keys %{$json->{levelname}}){ | |||||||||||||||||||||||||||
| 19 | 0 | $levelname{$_} = $json->{levelname}{$_}; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | 0 | my %last_speak_time; | |||||||||||||||||||||||||||
| 22 | 0 | for (keys %{$json->{times}}){ | |||||||||||||||||||||||||||
| 23 | 0 | $last_speak_time{$_} = $json->{times}{$_}; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | 0 | my %join_time; | |||||||||||||||||||||||||||
| 26 | 0 | for (keys %{$json->{join}}){ | |||||||||||||||||||||||||||
| 27 | 0 | $join_time{$_} = $json->{join}{$_}; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | 0 | my %adm; | |||||||||||||||||||||||||||
| 30 | 0 | $adm{$_} = 1 for @{$json->{adm}}; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | my %card; | |||||||||||||||||||||||||||
| 33 | 0 | for(keys %{$json->{cards}}){ | |||||||||||||||||||||||||||
| 34 | 0 | $card{$_} = $json->{cards}{$_}; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | my $group = {member=>[]}; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | $group->{max_admin} = undef; | |||||||||||||||||||||||||||
| 40 | 0 | $group->{admin_count} = undef; | |||||||||||||||||||||||||||
| 41 | 0 | $group->{member_count} = undef; | |||||||||||||||||||||||||||
| 42 | 0 | $group->{max_member} = undef; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | $group->{uid} = $uid; | |||||||||||||||||||||||||||
| 45 | 0 | $group->{owner_uid} = $json->{owner}; | |||||||||||||||||||||||||||
| 46 | 0 | for(@{$json->{mems}}){ | |||||||||||||||||||||||||||
| 47 | 0 | my $member = {}; | |||||||||||||||||||||||||||
| 48 | 0 | $member->{uid} = $_->{u}; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if($member->{uid} eq $group->{owner_uid}){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 51 | 0 | $member->{role} = 'owner'; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | elsif($adm{ $member->{uid} } == 1){ | ||||||||||||||||||||||||||||
| 54 | 0 | $member->{role} = 'admin'; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | else{ | ||||||||||||||||||||||||||||
| 57 | 0 | $member->{role} = 'member'; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | $member->{card} = (defined $card{$member->{uid}} and $card{$member->{uid}} ne "")?$self->xmlescape_parse($card{$member->{uid}}): undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $card{$member->{"uid"}} and $card{$member->{"uid"}} ne ""
MC/DC0%0/2
defined $card{$member->{"uid"}} and $card{$member->{"uid"}} ne ""
defined $card{$member->{"uid"}}
$card{$member->{"uid"}} ne ""
Truth table0%0/3
A and B
A= defined $card{$member->{"uid"}}B= $card{$member->{"uid"}} ne ""
| |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ($self->group_member_use_fullcard) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 0 | $member->{fullcard} = $member->{card}; | |||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | 0 | ▶ | if(not $self->group_member_card_ext_only){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | $member->{card} = $self->safe_truncate($member->{card},$self->group_member_card_cut_length) if defined $member->{card}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | 0 | $member->{name} = $self->xmlescape_parse($_->{n}); | |||||||||||||||||||||||||||
| 67 | 0 | $member->{last_speak_time} = $last_speak_time{$member->{uid}}; | |||||||||||||||||||||||||||
| 68 | 0 | $member->{join_time} = $join_time{$member->{uid}}; | |||||||||||||||||||||||||||
| 69 | 0 | push @{$group->{member}},$member; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | 0 | return $group; | |||||||||||||||||||||||||||
| 72 | 0 | }; | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | if($is_blocking){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | return $handle->( $self->http_post($api,{Referer=>"http://qinfo.clt.qq.com/member.html",json=>1},form=>{gc=>$uid,u=>$self->user->uid,bkn=>$self->get_csrf_token},) ); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | else{ | ||||||||||||||||||||||||||||
| 77 | 0 | ▶ | $self->http_post($api,{Referer=>"http://qinfo.clt.qq.com/member.html",json=>1},form=>{gc=>$uid,u=>$self->user->uid,bkn=>$self->get_csrf_token},sub{ | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 78 | 0 | my $json = shift; | |||||||||||||||||||||||||||
| 79 | 0 | $callback->( $handle->($json) ); | |||||||||||||||||||||||||||
| 80 | 0 | }); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | 1 | 1; | |||||||||||||||||||||||||||