File Coverage

blib/lib/Mojo/Weixin/Message/Remote/_revoke_message.pm
Criterion Covered Total %
statement 3 17 17.6
branch 0 6 0.0
condition n/a
subroutine 1 3 33.3
pod n/a
total 4 26 15.3


line stmt bran cond sub pod time code
1 1     1   7 use strict;
  1         2  
  1         249  
2             sub Mojo::Weixin::_revoke_message {
3 0     0     my $self = shift;
4 0           my ($msg_id,$receiver_id) = @_;
5 0           my $api = "https://".$self->domain . "/cgi-bin/mmwebwx-bin/webwxrevokemsg";
6 0           my @query_string =();
7 0 0         push @query_string,(pass_ticket => $self->url_escape($self->pass_ticket)) if $self->pass_ticket;
8             my $post = {
9             BaseRequest => {
10             DeviceID => $self->deviceid,
11             Sid => $self->wxsid,
12             Skey => $self->skey,
13             Uin => $self->wxuin,
14             },
15 0     0     ClientMsgId => sub{my $r = sprintf "%.3f", rand();$r=~s/\.//g;my $t = $self->now() . $r;$t;}->(),
  0            
  0            
  0            
  0            
16             SvrMsgId => $msg_id,
17             ToUserName => $receiver_id,
18             };
19              
20 0           my $json = $self->http_post($self->gen_url($api,@query_string),{blocking=>1,Referer=>'https://' . $self->domain . '/',json=>1},json=>$post);
21 0 0         return if not defined $json;
22 0 0         return if $json->{BaseResponse}{Ret} !=0;
23 0           return 1;
24             }
25              
26             1;