line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
292
|
|
2
|
|
|
|
|
|
|
sub Mojo::Webqq::Model::_get_group_list_info_ext { |
3
|
0
|
|
|
0
|
|
|
my $self = shift; |
4
|
0
|
|
|
|
|
|
my $callback = shift; |
5
|
0
|
|
|
|
|
|
my $api = 'http://qun.qq.com/cgi-bin/qun_mgr/get_group_list'; |
6
|
0
|
0
|
|
|
|
|
my $is_blocking = ref $callback eq "CODE"?0:1; |
7
|
|
|
|
|
|
|
my $handle = sub { |
8
|
0
|
|
|
0
|
|
|
my $json = shift; |
9
|
0
|
0
|
|
|
|
|
return if not defined $json; |
10
|
0
|
0
|
|
|
|
|
return if $json->{ec}!=0; |
11
|
|
|
|
|
|
|
#{"ec":0,"join":[{"gc":1299322,"gn":"perl技术","owner":4866832},{"gc":144539789,"gn":"PERL学习交流","owner":419902730},{"gc":213925424,"gn":"PERL","owner":913166583}],"manage":[{"gc":390179723,"gn":"IT狂人","owner":308165330}]} |
12
|
0
|
|
|
|
|
|
my @result; |
13
|
0
|
|
|
|
|
|
for my $t (qw(join manage create)){ |
14
|
0
|
|
|
|
|
|
for(@{$json->{$t}}){ |
|
0
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $group = {}; |
16
|
0
|
|
|
|
|
|
$group->{name} = $self->xmlescape_parse($_->{gn}); |
17
|
0
|
|
|
|
|
|
$group->{uid} = $_->{gc}; |
18
|
0
|
|
|
|
|
|
$group->{owner_uid} = $_->{owner}; |
19
|
0
|
0
|
|
|
|
|
$group->{role} = $t eq "join"?"attend":$t; |
20
|
0
|
|
|
|
|
|
push @result,$group; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
return \@result; |
24
|
0
|
|
|
|
|
|
}; |
25
|
0
|
0
|
|
|
|
|
if($is_blocking){ |
26
|
0
|
|
|
|
|
|
return $handle->($self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},)); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else{ |
29
|
|
|
|
|
|
|
$self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},sub{ |
30
|
0
|
|
|
0
|
|
|
my $json = shift; |
31
|
0
|
|
|
|
|
|
$callback->( $handle->($json) ); |
32
|
0
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
1; |