line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
sub Mojo::Webqq::Model::_get_discuss_list_info { |
2
|
0
|
|
|
0
|
|
|
my $self = shift; |
3
|
0
|
|
|
|
|
|
my $callback = shift; |
4
|
0
|
|
|
|
|
|
my $api_url = 'https://s.web2.qq.com/api/get_discus_list'; |
5
|
0
|
|
|
|
|
|
my @query_string = ( |
6
|
|
|
|
|
|
|
clientid => $self->clientid, |
7
|
|
|
|
|
|
|
psessionid => $self->psessionid, |
8
|
|
|
|
|
|
|
vfwebqq => $self->vfwebqq, |
9
|
|
|
|
|
|
|
t => time(), |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $headers = { |
13
|
|
|
|
|
|
|
Referer => 'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1', |
14
|
|
|
|
|
|
|
json => 1, |
15
|
|
|
|
|
|
|
}; |
16
|
0
|
0
|
|
|
|
|
my $is_blocking = ref $callback eq "CODE"?0:1; |
17
|
|
|
|
|
|
|
my $handle = sub { |
18
|
0
|
|
|
0
|
|
|
my $json = shift; |
19
|
0
|
0
|
|
|
|
|
return unless defined $json; |
20
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode}!=0; |
21
|
|
|
|
|
|
|
#{"retcode":0,"result":{"dnamelist":[{"name":"test","did":612950676}]}} |
22
|
0
|
|
|
|
|
|
for(@{ $json->{result}{dnamelist} }){ |
|
0
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$_->{id} = delete $_->{did}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
return $json->{result}{dnamelist}; |
27
|
0
|
|
|
|
|
|
}; |
28
|
0
|
0
|
|
|
|
|
if($is_blocking){ |
29
|
0
|
|
|
|
|
|
return $handle->( $self->http_get($self->gen_url($api_url,@query_string),$headers,) ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
else{ |
32
|
|
|
|
|
|
|
$self->http_get($self->gen_url($api_url,@query_string),$headers,sub{ |
33
|
0
|
|
|
0
|
|
|
my $json = shift; |
34
|
0
|
|
|
|
|
|
$callback->( $handle->($json) ); |
35
|
0
|
|
|
|
|
|
}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |