403Webshell
Server IP : 112.84.131.71  /  Your IP : 43.174.71.198
Web Server : nginx/1.28.0
System : Linux 1763701629066 6.8.0-53-generic #55-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 17 15:37:52 UTC 2025 x86_64
User : www ( 1001)
PHP Version : 8.2.28
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /www/wwwroot/www.lengcat.cn/wp-content/themes/onenav/iopay/sdk/payjs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/wwwroot/www.lengcat.cn/wp-content/themes/onenav/iopay/sdk/payjs/payjs.class.php
<?php
/**
 * PAYJS SDK For PHP
 * 单文件版本,有任何问题请直接提交issues
 * Github: https://github.com/payjs-cn/phpsdk
 * 2020.07 By PAYJS
 */

class Payjs
{
    protected $mchid;
    protected $key;
    protected $url;
    protected $api_url_native;
    protected $api_url_cashier;
    protected $api_url_refund;
    protected $api_url_close;
    protected $api_url_reverse;
    protected $api_url_check;
    protected $api_url_user;
    protected $api_url_info;
    protected $api_url_complaint;
    protected $api_url_bank;
    protected $api_url_jsapi;
    protected $api_url_mweb;

    public function __construct($mchid, $key)
    {
        $this->mchid = $mchid;
        $this->key = $key;

        $api_url = 'https://payjs.cn/api/';
        $this->api_url_native    = $api_url . 'native';
        $this->api_url_cashier   = $api_url . 'cashier';
        $this->api_url_refund    = $api_url . 'refund';
        $this->api_url_close     = $api_url . 'close';
        $this->api_url_reverse   = $api_url . 'reverse';
        $this->api_url_check     = $api_url . 'check';
        $this->api_url_user      = $api_url . 'user';
        $this->api_url_info      = $api_url . 'info';
        $this->api_url_complaint = $api_url . 'complaint';
        $this->api_url_bank      = $api_url . 'bank';
        $this->api_url_jsapi     = $api_url . 'jsapi';
        $this->api_url_mweb      = $api_url . 'mweb';
    }

    // 扫码支付
    public function native(array $data)
    {
        $this->url = $this->api_url_native;
        return $this->post($data);
    }

    // JSAPI 模式
    public function jsapi(array $data)
    {
        $this->url = $this->api_url_jsapi;
        return $this->post($data);
    }

    // H5 模式
    public function mweb(array $data)
    {
        $this->url = $this->api_url_mweb;
        return $this->post($data);
    }

    // 收银台模式
    public function cashier(array $data)
    {
        $this->url = $this->api_url_cashier;
        $data      = $this->sign($data);
        $url       = $this->url . '?' . http_build_query($data);
        return $url;
    }

    // 退款
    public function refund(array $data)
    {
        $this->url = $this->api_url_refund;
        return $this->post($data);
    }

    // 关闭订单
    public function close(array $data)
    {
        $this->url = $this->api_url_close;
        return $this->post($data);
    }
    
    // 撤销订单
    public function reverse(array $data)
    {
        $this->url = $this->api_url_reverse;
        return $this->post($data);
    }

    // 检查订单
    public function check($data)
    {
        $this->url = $this->api_url_check;
        return $this->post($data);
    }

    // 用户资料
    public function user($openid)
    {
        $this->url = $this->api_url_user;
        $data      = ['openid' => $openid];
        return $this->post($data);
    }

    // 商户资料
    public function info()
    {
        $this->url = $this->api_url_info;
        $data      = [];
        return $this->post($data);
    }
    
    // 投诉查询
    public function complaint()
    {
        $this->url = $this->api_url_complaint;
        $data      = [];
        return $this->post($data);
    }

    // 银行资料
    public function bank(array $data)
    {
        $this->url = $this->api_url_bank;
        return $this->post($data);
    }

    // 异步通知接收
    public function notify()
    {
        $data = $_POST;
        if ($this->checkSign($data) === true) {
            return $data;
        } else {
            return '验签失败';
        }
    }

    // 数据签名
    public function sign(array $data)
    {
        $data['mchid'] = $this->mchid;
        $data = array_filter($data);
        ksort($data);
        $data['sign'] = strtoupper(md5(urldecode(http_build_query($data) . '&key=' . $this->key)));
        return $data;
    }

    // 校验数据签名
    public function checkSign($data)
    {
        $in_sign = $data['sign'];
        unset($data['sign']);
        $data = array_filter($data);
        ksort($data);
        $sign = strtoupper(md5(urldecode(http_build_query($data) . '&key=' . $this->key)));
        return $in_sign == $sign ? true : false;
    }

    // 数据发送
    public function post($data)
    {
        $data   = $this->sign($data);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_URL, $this->url);
        curl_setopt($ch, CURLOPT_USERAGENT, 'HTTP CLIENT');
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_HEADER, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        curl_setopt($ch, CURLOPT_POST, TRUE);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

        $data = curl_exec($ch);
        curl_close($ch);
        return json_decode($data, true);
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit