line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
8
|
use Encode (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
2
|
1
|
|
|
1
|
|
5
|
use Encode::Locale; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
281
|
|
3
|
|
|
|
|
|
|
sub Mojo::Weixin::_get_qrcode_image{ |
4
|
0
|
|
|
0
|
|
|
my $self = shift; |
5
|
0
|
|
|
|
|
|
my $qrcode_uuid = shift; |
6
|
0
|
|
|
|
|
|
my $api = 'https://login.weixin.qq.com/qrcode/'; |
7
|
|
|
|
|
|
|
#my @query_string = ( |
8
|
|
|
|
|
|
|
# t => "webwx", |
9
|
|
|
|
|
|
|
#); |
10
|
0
|
|
|
|
|
|
my $url = $api . $qrcode_uuid; |
11
|
0
|
|
|
|
|
|
my $data = $self->http_get($url); |
12
|
0
|
0
|
|
|
|
|
if( not defined $data){ |
13
|
0
|
|
|
|
|
|
$self->error("登录二维码下载失败"); |
14
|
0
|
|
|
|
|
|
return 0; |
15
|
|
|
|
|
|
|
} |
16
|
0
|
|
|
|
|
|
$self->clean_qrcode(); |
17
|
0
|
0
|
|
|
|
|
$self->die("未设置二维码保存路径") if not defined $self->qrcode_path; |
18
|
0
|
|
|
|
|
|
eval{ |
19
|
0
|
0
|
|
|
|
|
open(my $fh,">",$self->qrcode_path) or die "$!\n"; |
20
|
0
|
|
|
|
|
|
binmode $fh; |
21
|
0
|
|
|
|
|
|
print $fh $data; |
22
|
0
|
|
|
|
|
|
close $fh; |
23
|
|
|
|
|
|
|
}; |
24
|
0
|
0
|
|
|
|
|
if($@){ |
25
|
0
|
|
|
|
|
|
$self->error("二维码写入文件[ " . $self->qrcode_path . " ]失败: $@"); |
26
|
0
|
|
|
|
|
|
return 0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $filename_for_log = Encode::encode("utf8",Encode::decode(locale_fs,$self->qrcode_path)); |
30
|
|
|
|
|
|
|
#$self->info("二维码已下载到本地[ $filename_for_log ]\n二维码原始下载地址[ $url ]"); |
31
|
0
|
|
|
|
|
|
$self->info("二维码已下载到本地[ $filename_for_log ]"); |
32
|
0
|
|
|
|
|
|
$self->emit(input_qrcode=>$self->qrcode_path,$data); |
33
|
0
|
|
|
|
|
|
return 1; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
1; |