| 1 | sub Mojo::Webqq::Message::_get_sess_sig { | ||
| 2 | my $self = shift; | ||
| 3 | my($id,$to_uin,$service_type,) = @_; | ||
| 4 | my $cache_data = $self->sess_sig_cache->retrieve("$id|$to_uin|$service_type"); | ||
| 5 | return $cache_data if defined $cache_data; | ||
| 6 | my $api_url = 'http://d1.web2.qq.com/channel/get_c2cmsg_sig2'; | ||
| 7 | my @query_string = ( | ||
| 8 | id => $id, | ||
| 9 | to_uin => $to_uin, | ||
| 10 | service_type => $service_type, | ||
| 11 | clientid => $self->clientid, | ||
| 12 | psessionid => $self->psessionid, | ||
| 13 | t => time, | ||
| 14 | ); | ||
| 15 | my $headers = {Referer=>'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2',json=>1}; | ||
| 16 | my $json = $self->http_get($self->gen_url($api_url,@query_string),$headers); | ||
| 17 | return undef unless defined $json; | ||
| 18 | return undef if $json->{retcode}!=0; | ||
| 19 | return undef if $json->{result}{value} eq ""; | ||
| 20 | $self->sess_sig_cache->store("$id|$to_uin|$service_type",$json->{result}{value},300); | ||
| 21 | return $json->{result}{value} ; | ||
| 22 | } | ||
| 23 | 1; |