',json=>1};
my $json = $self->http_get($self->gen_url($api_url,@query_string),$headers);
return undef unless defined $json;
return undef if $json->{retcode}!=0;
return undef if $json->
{result}{value} eq "";
$self->sess_sig_cache->store("$id|$to_uin|$service_type",$json->{result}{value},300);
return $json->{result}{value} ;
}
1;
rs = {
Referer=>'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
json=>1,
ua_request_timeout=> $self->model_update_timeout,
ua_retry_times => 3,
};
my $handle = sub{
my $json = shift;
return undef unless defined $json;
return undef if $json->{retcode} !=0;
my $friend_info = $json->{result};
$friend_info-
ers,) );
}
else{
$self->http_get($self->gen_url($api_url,@query_string),$headers,sub{
my $json = shift;
$callback->( $handle->($json) );
});
}
}
1;
= {
Referer => 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2',
json => 1,
};
my @query_string = (
vfwebqq => $self->vfwebqq,
clie
:1;
my $handle = sub {
my $json = shift;
return undef unless defined $json;
return undef if $json->{retcode} !=0;
for(@{$json->{result}}){
$_->{client_t
$_->{state} = $_->{status};
delete $_->{status};
}
return $json->{result};
};
if($is_blocking){
return $handle->( $self->http_get($self->gen_url
2';
my $headers = {Referer=>'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',json=>1};
my @query_string = (
tuin => $uin,
type => 1,
$json = $self->http_get($self->gen_url($api_url,@query_string),$headers);
return undef unless defined $json;
return undef if $json->{retcode} !=0;
$self->id_to_qq_cache->store($uin,$json-
>{result}{account});
return $json->{result}{account};
}
1;
"CODE"?0:1;
my $handle = sub {
my $json = shift;
return if not defined $json;
return if $json->{ec}!=0;
if(ref $json->{mems} ne 'ARRAY'){
$self->warn("
s %{$json->{levelname}}){
$levelname{$_} = $json->{levelname}{$_};
}
my %last_speak_time;
for (keys %{$json->{times}}){
$last_speak_time{$_} = $json->{t
or (keys %{$json->{join}}){
$join_time{$_} = $json->{join}{$_};
}
my %adm;
$adm{$_} = 1 for @{$json->{adm}};
my %card;
for(keys %{$json->{cards}})
ef $callback eq "CODE"?0:1;
my $handle = sub {
my $json = shift;
return if not defined $json;
return if $json->{ec}!=0;
#{"ec":0,"join":[{"gc":1299322,"gn":"perl技
308165330}]}
my @result;
for my $t (qw(join manage create)){
for(@{$json->{$t}}){
my $group = {};
$group->{name} = $self->xmlescape_parse(
ttp://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},));
}
else{
$self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_cs
json=>1,
ua_request_timeout => $self->model_update_timeout,
ua_retry_times => 3,
};
my $is_blocking = ref $callback eq "CODE"?0:1;
my $handle = sub {
my $json =
ft;
return unless defined $json;
my $ginfo_status = exists $json->{result}{ginfo}?"[ginfo-ok]":"[ginfo-not-ok]";
my $minfo_status = ref $json->{result}{minfo} eq "ARRAY"?"[minf
exists $json->{result}{ginfo};
$json->{result}{ginfo}{id} = delete $json->{result}{ginfo}{gid};
$json->{result}{ginfo}{code} = delete $json->{result}{ginfo}{code};
$json->{resu
= {
Referer => 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2',
json => 1,
ua_request_timeout => $self->model_update_timeout,
ua_retry_times => 3,
my $handle = sub{
my $json = shift;
return unless defined $json;
return undef if $json->{retcode}!=0;
return undef unless exists $json->{result}{info};
my $minfo = [];
for(@{ $json->{result}{info}{mem_list} }){
$mem_list{$_->{mem_uin}}{ruin} = $_->{ruin};
}
for(@{ $json->{result}{mem_status} }){
Referer => 'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
json => 1,
ua_request_timeout => $self->model_update_timeout,
ua_retry_times =
1;
my $handle = sub{
my $json = shift;
return undef unless defined $json;
return undef if $json->{retcode} !=0;
my $user = $json->{result};
$user->{state} =
r->{gender};
#my $single_long_nick = $self->get_single_long_nick( $self->uid );
#$json->{result}{signature} = $single_long_nick if defined $single_long_nick;
$user->{uid}
ef $callback eq "CODE"?0:1;
my $handle = sub {
my $json = shift;
return if not defined $json;
return if $json->{ec}!=0;
#{"adm_max":10,"adm_num":1,"count":4,"ec":0,
;
for(keys %{$json->{levelname}}){
$levelname{$_} = $json->{levelname}{$_};
}
my $group = {member=>[]};
$group->{max_admin} = $json->{adm_max};
$g
admin_count} = $json->{adm_num};
$group->{member_count} = $json->{count};
$group->{max_member} = $json->{max_count};
$group->{uid} = $uid;
for(@{$json->{mems}}){
.clt.qq.com/cgi-bin/qun_info/set_group_admin";
my $json = $self->http_post(
$api,{Referer=>"http://qinfo.clt.qq.com/member.html",json=>1},
form=>{src=>"qinfo_v2",gc=>$uid,u=>join("
|",$qq[0]),op=>1,bkn=>$self->get_csrf_token}
);
return if not defined $json;
return if $json->{ec}!=0;
return 1;
}
1;
rn;
}
my $api = 'http://qiandao.qun.qq.com/cgi-bin/sign';
my $json = $self->http_post(
$api,
{json=>1,Referer=>"http://qiandao.qun.qq.com/index.html?groupUin=$uid&appID=100
ned $json;
#{"conti_count":1,"ec":0,"is_new":0,"is_sign":1,"now":1464858442,"rank":2,"sign_time":1464858442,"today_count":2,"total_count":1}
return if $json->{ec} != 0;
return if $json->{i
ref $callback eq "CODE"?0:1;
my $handle = sub{
my $json = shift;
return if not defined $json;
return if $json->{ec}!=0;
#{"ec":0,"result":{"0":{"mems":[{"name":"卖
r my $category_index (keys %{$json->{result}}){
my $category = ($category_index==0 and !defined $json->{result}{$category_index}{gname})?"我的好友":($json->{result}{$category_index}{gn
ame});
next if ref $json->{result}{$category_index}{mems} ne "ARRAY";
for my $f (@{ $json->{result}{$category_index}{mems} }){
my $friend = {
$json = $self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{gc=>$uid,ul=>join("|",@qq),bkn=>$self->get_csrf_token});
return if not defined $json;
return if $json->
json => 1,
};
my $is_blocking = ref $callback eq "CODE"?0:1;
my $handle = sub {
my $json = shift;
return unless defined $json;
return undef if $json->{ret
":"test","did":612950676}]}}
for(@{ $json->{result}{dnamelist} }){
$_->{id} = delete $_->{did};
}
return $json->{result}{dnamelist};
};
if($is_blo
rs,) );
}
else{
$self->http_get($self->gen_url($api_url,@query_string),$headers,sub{
my $json = shift;
$callback->( $handle->($json) );
});
}
}
1;
et_csrf_token};
my $json = $self->http_post($api,{Referer=>"http://qinfo.clt.qq.com/member.html",json=>1},form=>$form);
return if not defined $json;
return if $json->{ec}!=0;
return 1;
方法:
dump #打印消息结构,主要用于调试
to_json_hash #将消息转换为json兼容的hash,方便和外部系统交互
#常见的接收
获取发送者的名称
my $json_hash = $msg->to_json_hash(); #获取到hash引用
my $json_text = $client->to_json($json_hash); #将hash转换为json字符串
$msg->dump();
$ms
#json=>1 表示将响应的json数据进行转换得到perl的hash引用
#retry_times=>3 表示请求失败自动重试次数,默认使用$client->ua_retry_times的值
my $json_decode_h