...
|
...
|
@@ -356,4 +356,45 @@ class OrderController extends HomeBaseController |
|
|
}
|
|
|
}
|
|
|
|
|
|
public function alipay()
|
|
|
{
|
|
|
header("Content-type: text/html; charset=utf-8");
|
|
|
require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php';
|
|
|
require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
|
|
|
require EXTEND_PATH . '/alipay/config.php';
|
|
|
if (1 == 1) {
|
|
|
//商户订单号,商户网站订单系统中唯一订单号,必填
|
|
|
$out_trade_no = '20181017210243564' . rand(10000, 99999);
|
|
|
|
|
|
//订单名称,必填
|
|
|
$subject = '购买';
|
|
|
|
|
|
//付款金额,必填
|
|
|
$total_amount = 0.01;
|
|
|
|
|
|
//商品描述,可空
|
|
|
$body = '商品';
|
|
|
|
|
|
//超时时间
|
|
|
$timeout_express = "1m";
|
|
|
|
|
|
$payRequestBuilder = new \AlipayTradeWapPayContentBuilder();
|
|
|
$payRequestBuilder->setBody($body);
|
|
|
$payRequestBuilder->setSubject($subject);
|
|
|
$payRequestBuilder->setOutTradeNo($out_trade_no);
|
|
|
$payRequestBuilder->setTotalAmount($total_amount);
|
|
|
$payRequestBuilder->setTimeExpress($timeout_express);
|
|
|
|
|
|
$payResponse = new \AlipayTradeService($config);
|
|
|
$result = $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);
|
|
|
return $this->fetch(':alipay', [
|
|
|
'url' => $result
|
|
|
]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function alipayDo() {
|
|
|
return $this->fetch(':pay');
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|