2022-03-21 18:05:51 +08:00
|
|
|
<?php
|
|
|
|
|
namespace extend\wechatpay;
|
|
|
|
|
|
2022-03-22 16:05:07 +08:00
|
|
|
require_once APP_PATH . "extends/wechatpay/lib/WxPay.Api.php";
|
|
|
|
|
require_once APP_PATH . 'extends/wechatpay/example/WxPay.NativePay.php';
|
2022-03-21 18:05:51 +08:00
|
|
|
class Wxpay
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @description:
|
|
|
|
|
* @param {*} $param username,money,order_no
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function pay($param) {
|
|
|
|
|
$notify = new \NativePay();
|
|
|
|
|
$input = new \WxPayUnifiedOrder();
|
2022-03-22 16:05:07 +08:00
|
|
|
$input->SetBody("购买软路由-".$param['username']);
|
2022-03-21 18:05:51 +08:00
|
|
|
$input->SetOut_trade_no($param['order_no']);
|
|
|
|
|
$input->SetTotal_fee($param['money']);
|
|
|
|
|
$input->SetTime_start(date("YmdHis"));
|
|
|
|
|
$input->SetTime_expire(date("YmdHis", time() + 600));
|
2022-03-22 16:05:07 +08:00
|
|
|
$input->SetNotify_url("http://php-api.juip.com/common/wxpay/wxpayverify");
|
2022-03-21 18:05:51 +08:00
|
|
|
$input->SetTrade_type("NATIVE");
|
|
|
|
|
|
|
|
|
|
$result = $notify->GetPayUrl($input);
|
|
|
|
|
|
|
|
|
|
$url2 = $result["code_url"];
|
|
|
|
|
return $url2;
|
|
|
|
|
}
|
2023-12-26 16:37:09 +08:00
|
|
|
|
|
|
|
|
public function http_pay($param) {
|
|
|
|
|
$notify = new \NativePay();
|
|
|
|
|
$input = new \WxPayUnifiedOrder();
|
|
|
|
|
$input->SetBody("HTTP充值");
|
|
|
|
|
$input->SetOut_trade_no($param['order_no']);
|
|
|
|
|
$input->SetTotal_fee($param['money']);
|
|
|
|
|
$input->SetTime_start(date("YmdHis"));
|
|
|
|
|
$input->SetTime_expire(date("YmdHis", time() + 600));
|
|
|
|
|
$input->SetNotify_url("http://php-api.juip.com/common/wxpay/httpwxpayverify");
|
|
|
|
|
$input->SetTrade_type("NATIVE");
|
|
|
|
|
|
|
|
|
|
$result = $notify->GetPayUrl($input);
|
|
|
|
|
|
|
|
|
|
$url2 = $result["code_url"];
|
|
|
|
|
return $url2;
|
|
|
|
|
}
|
2024-02-01 17:13:32 +08:00
|
|
|
|
|
|
|
|
public function jinyou_pay($param) {
|
|
|
|
|
$notify = new \NativePay();
|
|
|
|
|
$input = new \WxPayUnifiedOrder();
|
|
|
|
|
$input->SetBody("购买水滴");
|
|
|
|
|
$input->SetOut_trade_no($param['order_no']);
|
|
|
|
|
$input->SetTotal_fee($param['money']);
|
|
|
|
|
$input->SetTime_start(date("YmdHis"));
|
|
|
|
|
$input->SetTime_expire(date("YmdHis", time() + 600));
|
|
|
|
|
$input->SetNotify_url("http://php-api.juip.com/common/wxpay/jinyouwxpayverify");
|
|
|
|
|
$input->SetTrade_type("NATIVE");
|
|
|
|
|
|
|
|
|
|
$result = $notify->GetPayUrl($input);
|
|
|
|
|
|
|
|
|
|
$url2 = $result["code_url"];
|
|
|
|
|
return $url2;
|
|
|
|
|
}
|
2024-02-22 16:13:10 +08:00
|
|
|
|
|
|
|
|
public function jinqiao_pay($param) {
|
|
|
|
|
$notify = new \NativePay();
|
|
|
|
|
$input = new \WxPayUnifiedOrder();
|
|
|
|
|
$input->SetBody("购买金桥投屏");
|
|
|
|
|
$input->SetOut_trade_no($param['order_no']);
|
|
|
|
|
$input->SetTotal_fee($param['money']);
|
|
|
|
|
$input->SetTime_start(date("YmdHis"));
|
|
|
|
|
$input->SetTime_expire(date("YmdHis", time() + 600));
|
|
|
|
|
$input->SetNotify_url("http://php-api.juip.com/common/wxpay/jinqiaowxpayverify");
|
|
|
|
|
$input->SetTrade_type("NATIVE");
|
|
|
|
|
|
|
|
|
|
$result = $notify->GetPayUrl($input);
|
|
|
|
|
|
|
|
|
|
$url2 = $result["code_url"];
|
|
|
|
|
return $url2;
|
|
|
|
|
}
|
2022-03-21 18:05:51 +08:00
|
|
|
}
|