line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
2
|
1
|
|
|
1
|
|
5
|
use Mojo::Weixin::Const qw(%KEY_MAP_GROUP %KEY_MAP_GROUP_MEMBER); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
68
|
|
3
|
1
|
|
|
1
|
|
358
|
use Mojo::Weixin::Model::Remote::_webwxbatchgetcontact_group_member; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
402
|
|
4
|
|
|
|
|
|
|
sub Mojo::Weixin::_webwxbatchgetcontact_group{ |
5
|
0
|
|
|
0
|
|
|
my $self = shift; |
6
|
0
|
|
0
|
|
|
|
my $is_update_group_member_detail = shift // 1; |
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) ){ |
12
|
0
|
|
|
|
|
|
my @query_string = ( |
13
|
|
|
|
|
|
|
type => "ex", |
14
|
|
|
|
|
|
|
r => $self->now(), |
15
|
|
|
|
|
|
|
); |
16
|
0
|
0
|
|
|
|
|
push @query_string,(pass_ticket => $self->pass_ticket) if $self->pass_ticket; |
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 ], |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
}; |
27
|
0
|
|
|
|
|
|
my $json = $self->http_post($self->gen_url2($api,@query_string),{Referer=>'https://'.$self->domain . '/',json=>1},json=>$post); |
28
|
0
|
0
|
|
|
|
|
next unless defined $json; |
29
|
0
|
0
|
|
|
|
|
next if $json->{BaseResponse}{Ret}!=0; |
30
|
0
|
|
|
|
|
|
for my $e (@{$json->{ContactList}}){ |
|
0
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
next if not $self->is_group_id($e->{UserName}); |
32
|
0
|
|
|
|
|
|
my $group = {}; |
33
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_GROUP){ |
34
|
0
|
|
0
|
|
|
|
$group->{$_} = $e->{$KEY_MAP_GROUP{$_}} // ""; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
0
|
|
|
|
|
if($is_update_group_member_detail){ |
37
|
0
|
|
|
|
|
|
my @member = $self->_webwxbatchgetcontact_group_member($group->{_eid},map {$_->{UserName}} @{$e->{MemberList}}); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
if(@member){ |
39
|
0
|
|
|
|
|
|
$group->{member} = \@member; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
else{ |
42
|
0
|
|
|
|
|
|
for my $m (@{$e->{MemberList}}){ |
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
my $member = {}; |
44
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_GROUP_MEMBER){ |
45
|
0
|
|
0
|
|
|
|
$member->{$_} = $m->{$KEY_MAP_GROUP_MEMBER{$_}} // ""; |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
|
$member->{sex} = $self->code2sex($member->{sex}); |
48
|
0
|
|
|
|
|
|
push @{$group->{member}},$member; |
|
0
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else{ |
53
|
0
|
|
|
|
|
|
for my $m (@{$e->{MemberList}}){ |
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my $member = {}; |
55
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_GROUP_MEMBER){ |
56
|
0
|
|
0
|
|
|
|
$member->{$_} = $m->{$KEY_MAP_GROUP_MEMBER{$_}} // ""; |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
$member->{sex} = $self->code2sex($member->{sex}); |
59
|
0
|
|
|
|
|
|
push @{$group->{member}},$member; |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
0
|
|
|
|
|
|
push @return,$group; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
0
|
0
|
|
|
|
|
return if @return ==0; |
67
|
0
|
0
|
|
|
|
|
return wantarray?@return:$return[0]; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |