Group
Extension

Matches 42

Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/doc/Weixin.pod ( view source; MetaCPAN )
以在http header设置一些请求相关的选项,比如:
    #json=>1                表示将响应的json数据进行json decode得到perl的hash引用
    #ua_retry_times=>3      表示请求
时间
    #ua_inactivity_timeout  阻塞http请求idle 超时时间
    my $json_decode_hash = $client->http_get($url,{json=>1,retry_times=>3,Host=>"www.qq.com"});

    #http post请求
    $client->
   post_event => 1, 
    });

    #接收到消息后,插件会通过HTTP POST请求的方式将json格式的消息上报到http://127.0.0.1:4000/post_api

    普通好友消息或群消息上报

Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Message/Remote/_revoke_message.pm ( view source; MetaCPAN )
 my $json = $self->http_post($self->gen_url($api,@query_string),{blocking=>1,Referer=>'https://' . $self->domain .  '/',json=>1},json=>$post);
    return if not defined $json;
    return if $json->{Ba
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/SmartReply.pm ( view source; MetaCPAN )
$json = {
            "key"       =>  $data->{apikey} || "bbdaba85b5cf47bc80e27cbaee7a77df",
            "userid"    =>  $msg->sender->id,
            "info"      =>  $input,
        };

        $json
pi,{json=>1},json=>$json,sub{
            my $json = shift;
            return unless defined $json;
            return if $json->{code}=~/^4000[1-7]$/;
            my $reply;
            if($json->{c
       return unless $json->{text};
                $reply = $json->{text};
            } 
            elsif($json->{code} == 200000){
                $reply = "$json->{text}$json->{url}";
           
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/UploadQRcode2.pm ( view source; MetaCPAN )
de($signtemp . $orignal,"");

    my $json = $client->http_post("http://web.file.myqcloud.com/files/v1/$appid/$bucket/$name",
        { Authorization=>$sign, json=>1 ,ua_debug_req_body=>0},
        fo

    );
    if(not defined $json){
        $client->warn("二维码图片上传云存储失败: 响应数据异常");
        return;
    }
    elsif(defined $json and $json->{code} != 0 ){
        $c
lient->warn("二维码图片上传云存储失败: " . $json->{message});
        return;
    }
    
    my $url = $json->{data}{source_url};
    $url=~s/(^https?:\/\/)([^\/]+)(.*)/$1$mydomain$3/ if (
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/FmPush.pm ( view source; MetaCPAN )

            $senderType = '2';
        }
        return if !$title or !$message;
		
		my $messageJson = '{"content":"{\"isAt\":\"'.$isAt.'\",\"type\":\"'.$type.'\",\"title\":\"'.$title.'\",\"message\
}"}';
		print "appId=".$app_id."messageJson=".$messageJson."pushIds=".$registration_id.$api_key;
		my $sign = md5_sum("appId=".$app_id."messageJson=".$messageJson."pushIds=".$registration_id.$api_key)
=>1,ua_debug_res_body=>1,json=>1},
            form=>{
                appId => $app_id,
                pushIds => $registration_id,
                messageJson=>$messageJson,
				sign  => $sign,
   
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/UploadQRcode.pm ( view source; MetaCPAN )
的云存储路径,防止好像干扰
        my $json = $client->http_post('https://sm.ms/api/upload',{json=>1},form=>{
            format=>'json',
            smfile=>{filename=>$qrcode_path,conte
    if(not defined $json){
            $client->warn("二维码图片上传云存储失败: 响应数据异常");
            return;
        }
        elsif(defined $json and $json->{code} ne 'succes
存储失败: " . $json->{msg});
            return;
        }
        $client->qrcode_upload_url($json->{data}{url});
        $client->info("二维码已上传云存储[ ". $json->{data}{url} . " ]")
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/Perldoc.pm ( view source; MetaCPAN )
e,{json=>1},sub{
                my $json = shift;
                return unless defined $json;
                my $doc;
                my $code;
                if(defined $json->{code} and $json->{
code} == 404){
                    $doc = "模块名称: $module ($json->{message})" ;
                    $code = 404; 
                    $metacpan_cache->store($module,{code=>$code,doc=>$doc},6048
 = 200;
                    my $author  =   $json->{author};
                    my $version =   $json->{version};
                    my $abstract=   $json->{abstract};
                    my $podlin
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/Translation.pm ( view source; MetaCPAN )
          $msg->allow_plugin(0);
            my $salt = time;
            $client->http_get($api,{json=>1},form=>{
                q     => $query,
                from  => 'auto',
                to 
b{
                my $json = shift;
                if( not defined $json ){$msg->reply("翻译失败: api接口不可用")}
                elsif(defined $json and exists $json->{error_code}){
     
可用(" . $json->{error_code} . " " . $json->{error_msg} . ")"); 
                }
                elsif(defined $json){
                    $msg->reply( join " ",map {$_->{dst}} @{ $json->{trans_re
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/PostQRcodeToTelegram.pm ( view source; MetaCPAN )
g/bot' . $data->{api_key} .'/sendPhoto';
        my $response = $client->http_post($telegram_api,{json=>1},form=>{
            chat_id => $data->{chat_id},
            caption => '微信登录二维
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/Beauty.pm ( view source; MetaCPAN )
$unicode_data);
                my $json = $client->from_json($data);
                if(defined $json and defined  $json->{pins}){
                    for(@{ $json->{pins} }){
                       
'application/json',
                    Referer=>$board->{url},
                    'X-Request'=>'JSON',
                    'X-Requested-With'=>'XMLHttpRequest',
                    json=>1,
        
                    my $json = shift;
                    return if not defined $json;
                    if(defined $json->{board}{pins} ){
                        if(@{$json->{board}{pins}} > 0){
 
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/GCM.pm ( view source; MetaCPAN )
ge;
        $client->http_post($api_url, 
            {'Authorization'=>"key=$api_key",json=>1},
            json=>{
                registration_ids=> $registration_ids,
                $collapse_key
"message_id":"0:1484103730761325%9b9e6c13f9fd7ecd"}]}"
                my $json = shift;
                if(not defined $json){
                    $client->debug("[".__PACKAGE__."]GCM消息推送失

                    $client->debug("[".__PACKAGE__."]GCM消息推送完成:$json->{multicast_id}/$json->{success}/$json->{failure}");
                }
            }
        );
    });

    $client
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/Openwx.pm ( view source; MetaCPAN )
ost_json = {};
            $post_json->{post_type} = "event";
            $post_json->{event} = $event;
            $post_json->{params} = [@args];
            $client->stdout_line($client->to_json($p
ost_json)) if $data->{post_stdout};
            if(defined $data->{post_api}){
                my($data,$ua,$tx) = $client->http_post($data->{post_api},{ua_connect_timeout=>5,ua_request_timeout=>5,ua_
inactivity_timeout=>5,ua_retry_times=>1},json=>$post_json);
                if($tx->res->is_success){
                    $client->debug("插件[".__PACKAGE__ ."]事件[".$event . "](@args)上报成
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/Weather.pm ( view source; MetaCPAN )
                                          my $json = $client->from_json($content);
                                                    if(not defined $json){
                                          
              $client->debug("[ " . __PACKAGE__ . " ]json数据解析失败");
                                                        return;
                                                    }
   
                                                 my $result = join "\n",map {$_->{Title}} @{$json};
							$result = $result;
				                              		$msg->reply($result);
				            
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin.pm ( view source; MetaCPAN )
       => 3;           #全局发送消息间隔
has json_codec_mode     => 0;  #0表示使用from_json/to_json 1表示使用decode_json/encode_json

has notice_api => 'https://raw.githubusercontent.c
sub {File::Spec->catfile($_[0]->tmpdir,join('','mojo_weixin_state_',$_[0]->account || 'default','.json'))};
has ioloop              => sub {Mojo::IOLoop->singleton};
has keep_cookie         => 1;
has 
ator->(@_);
    });
    $transactor->add_generator(json=>sub{
        $_[1]->req->body($self->to_json($_[2]))->headers->content_type('application/json');
        return $_[1];
    });
    Mojo::UserAg
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Client.pm ( view source; MetaCPAN )
       my ($json,$status) = @_;
        $self->_synccheck_interval($status?$self->synccheck_interval:$self->synccheck_interval+$self->synccheck_delay);
        $self->_parse_sync_data($json);
    });
 $json = {plugin => []};
        for my $attr (@attr){
            $json->{$attr} = $self->$attr;
        }
        $json->{previous_state} = $previous_state;
        $json->{pid} = $$;
        $json-
>{os}  = $^O;
        for my $p (keys %{ $self->plugins }){
            push @{ $json->{plugin} } , { name=>$self->plugins->{$p}{name},priority=>$self->plugins->{$p}{priority},auto_call=>$self->plugin
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Request.pm ( view source; MetaCPAN )

    }
}
sub _http_request{
    my $self = shift;
    my $method = shift;
    my %opt = (
        json                =>  0,  
        blocking            =>  0,
        ua_retry_times      =>  $self-
dy
    );
    if(ref $_[1] eq "HASH"){#with header or option
        $opt{json} = delete $_[1]->{json} if defined $_[1]->{json};
        $opt{blocking} = delete $_[1]->{blocking} if defined $_[1]->{bl
ie();
            if(defined $tx and $tx->res->is_success){
                my $r = $opt{json}?$self->from_json($tx->res->body):$tx->res->body;
                $cb->($r,$ua,$tx);
            }
       
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Controller.pm ( view source; MetaCPAN )
::Spec->catfile($ENV{MOJO_WEIXIN_TMPDIR},join('','mojo_weixin_state_',$ENV{MOJO_WEIXIN_ACCOUNT},'.json')) if not defined $ENV{MOJO_WEIXIN_STATE_PATH};
    $ENV{MOJO_WEIXIN_QRCODE_PATH} = File::Spec->c
e Mojo::JSON ();
use Mojo::Util ();
use base qw(Mojolicious::Controller);
sub render{
    my $self = shift;
    if($_[0] eq 'json'){
        $self->res->headers->content_type('application/json');
    
    $self->SUPER::render(data=>Mojo::JSON::to_json($_[1]),@_[2..$#_]);
    }
    else{$self->SUPER::render(@_)}
}
sub safe_render{
    my $self = shift;
    $self->render(@_) if (defined $self->tx and
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/MiPush.pm ( view source; MetaCPAN )
$title or !$message;
		
		$client->http_post($api_url, 
			{'Authorization'=>"key=$api_key",
			  json=>1
			},
            form=>{
                pass_through => 1,
                registration_id =
payload=>$client->to_json({isAt=>$isAt,type=>$type,title=>$title,message=>$message,msgId=>$msgId,senderType=>$senderType}),
            },
            sub{
                my $json = shift;
          
      if(not defined $json){
                    $client->debug("[".__PACKAGE__."]小米消息推送失败: 返回结果异常");
                    return;
                }
                else{
  
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Plugin/HwPush.pm ( view source; MetaCPAN )
tle or !$message;
		
		
		
		my $result=$client->http_post($api_url, {json=>1},
            form=>{
                nsp_fmt => JSON,
                deviceToken => $deviceToken,
                push_t
message=>$client->to_json({isAt=>$isAt,type=>$type,title=>$title,message=>$message,msgId=>$msgId,senderType=>$senderType}),
            },
            sub{
                my $json = shift;
          
      if(not defined $json){
                    $client->debug("[".__PACKAGE__."]华为消息推送失败: 返回结果异常");
                    return;
                }
                else{
  
Mojo-Weixin ( S/SJ/SJDY/Mojo-Weixin-1.4.6.tar.gz, SJDY, 2019; MetaCPAN )
Mojo-Weixin/lib/Mojo/Weixin/Util.pm ( view source; MetaCPAN )
ge Mojo::Weixin::Util;
use Carp qw();
use Encode ();
use IO::Handle;
use Mojo::Util ();
use Mojo::JSON qw();
use Mojo::Weixin::Const qw(%FACE_MAP_QQ %FACE_MAP_EMOJI);
my %emoji_to_text_map = reverse %
from_json{
    my $self = shift;
    my $r = eval{
        if($self->json_codec_mode == 0){
            my $json = Mojo::JSON::from_json(@_);
            $json;
        }
        elsif($self->json_cod
      my $json  = Mojo::JSON::decode_json(@_);
            $self->reform($json);
            $json;
        }
        else{
            my $json = Mojo::JSON::from_json(@_);
            $json;
       

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.