line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
5
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
3
|
1
|
|
|
1
|
|
7
|
use Mojo::Weixin::Const qw(%KEY_MAP_USER %KEY_MAP_GROUP %KEY_MAP_GROUP_MEMBER %KEY_MAP_FRIEND); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
147
|
|
4
|
|
|
|
|
|
|
sub Mojo::Weixin::_webwxinit{ |
5
|
0
|
|
|
0
|
|
|
my $self = shift; |
6
|
0
|
|
|
|
|
|
my $api = "https://". $self->domain . "/cgi-bin/mmwebwx-bin/webwxinit"; |
7
|
|
|
|
|
|
|
my @query_string = ( |
8
|
1
|
|
|
1
|
|
8
|
r => sub{use integer;unpack 'i',~ pack 'l',$self->now() & 0xFFFFFFFF}->(), |
|
1
|
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
); |
10
|
0
|
0
|
|
|
|
|
push @query_string,(pass_ticket => $self->url_escape($self->pass_ticket)) if $self->pass_ticket; |
11
|
0
|
|
|
|
|
|
my $post = { |
12
|
|
|
|
|
|
|
BaseRequest => { |
13
|
|
|
|
|
|
|
Uin => $self->wxuin, |
14
|
|
|
|
|
|
|
Sid => $self->wxsid, |
15
|
|
|
|
|
|
|
Skey => $self->skey, |
16
|
|
|
|
|
|
|
DeviceID => $self->deviceid, |
17
|
|
|
|
|
|
|
}, |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $json = $self->http_post($self->gen_url($api,@query_string),{json=>1,Referer=>'https://'.$self->domain .'/'},json=>$post); |
21
|
0
|
0
|
|
|
|
|
return if not defined $json; |
22
|
0
|
0
|
|
|
|
|
return if $json->{BaseResponse}{Ret}!=0; |
23
|
0
|
0
|
|
|
|
|
$self->sync_key($json->{SyncKey}) if $json->{SyncKey}{Count} !=0; |
24
|
0
|
0
|
|
|
|
|
$self->skey($json->{Skey}) if $json->{Skey}; |
25
|
0
|
|
|
|
|
|
my $user = {}; |
26
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_USER){ |
27
|
0
|
|
0
|
|
|
|
$user->{$_} = $json->{User}{$KEY_MAP_USER{$_}} // ""; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my @friends; |
31
|
|
|
|
|
|
|
my @groups; |
32
|
0
|
|
|
|
|
|
for my $e (@{ $json->{ContactList} }){ |
|
0
|
|
|
|
|
|
|
33
|
0
|
0
|
|
|
|
|
if($self->is_group_id($e->{UserName})){ |
34
|
0
|
|
|
|
|
|
my $group = {}; |
35
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_GROUP){ |
36
|
0
|
|
0
|
|
|
|
$group->{$_} = $e->{$KEY_MAP_GROUP{$_}} // ""; |
37
|
|
|
|
|
|
|
} |
38
|
0
|
|
|
|
|
|
for my $m (@{$e->{MemberList}}){ |
|
0
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $member = {_group_id=>$group->{id}}; |
40
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_GROUP_MEMBER){ |
41
|
0
|
|
0
|
|
|
|
$member->{$_} = $m->{$KEY_MAP_GROUP_MEMBER{$_}} // ""; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
|
$member->{sex} = $self->code2sex($member->{sex}); |
44
|
0
|
|
|
|
|
|
push @{$group->{member}},$member; |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
|
push @groups,$group; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else{ |
49
|
0
|
|
|
|
|
|
my $friend = {}; |
50
|
0
|
|
|
|
|
|
for(keys %KEY_MAP_FRIEND){ |
51
|
0
|
|
0
|
|
|
|
$friend->{$_} = $e->{$KEY_MAP_FRIEND{$_}} // "" ; |
52
|
|
|
|
|
|
|
} |
53
|
0
|
|
|
|
|
|
$friend->{sex} = $self->code2sex($friend->{sex}); |
54
|
0
|
|
|
|
|
|
push @friends,$friend; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
my @id = $json->{ChatSet}?split /,/,$json->{ChatSet}:(); |
59
|
0
|
|
|
|
|
|
for(@id){ |
60
|
0
|
0
|
|
|
|
|
if($self->is_group_id($_)){ |
61
|
0
|
|
|
|
|
|
push @groups,{id=>$_}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
else{ |
64
|
0
|
|
|
|
|
|
push @friends,{id=>$_}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
0
|
|
|
|
|
|
return [$user,\@friends,\@groups]; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
1 |