| 1 | 0 | ▶ | sub Mojo::Webqq::Model::get_qq_from_id{ | ||||||||
|
Subroutine
get_qq_from_id: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 2 | 0 | my $self = shift; | |||||||||
| 3 | 0 | return ; | |||||||||
| 4 | 0 | my $uin = shift; | |||||||||
| 5 | 0 | my $cache_data = $self->id_to_qq_cache->retrieve($uin); | |||||||||
| 6 | 0 | ▶ | return $cache_data if defined $cache_data; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 7 | 0 | my $api_url = 'https://s.web2.qq.com/api/get_friend_uin2'; | |||||||||
| 8 | 0 | my $headers = {Referer=>'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',json=>1}; | |||||||||
| 9 | 0 | my @query_string = ( | |||||||||
| 10 | tuin => $uin, | ||||||||||
| 11 | type => 1, | ||||||||||
| 12 | vfwebqq => $self->vfwebqq, | ||||||||||
| 13 | t => time, | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | 0 | my $json = $self->http_get($self->gen_url($api_url,@query_string),$headers); | |||||||||
| 17 | 0 | ▶ | return undef unless defined $json; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | ▶ | return undef if $json->{retcode} !=0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | $self->id_to_qq_cache->store($uin,$json->{result}{account}); | |||||||||
| 20 | 0 | return $json->{result}{account}; | |||||||||
| 21 | } | ||||||||||
| 22 | 1 | 1; | |||||||||