作者 lihan
1 个管道 的构建 通过 耗费 0 秒

支付宝

... ... @@ -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
... ...
... ... @@ -161,45 +161,4 @@ class IndexController 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
... ...
... ... @@ -42,7 +42,7 @@
<div id="pay-methods-panel" class="pay-methods-panel">
<div class="wrapper buy-wrapper">
<!-- 该链接是拼接的请求,需要做urlEncode -->
<a href="{$url}" class="J-btn-submit btn mj-submit btn-strong btn-larger btn-block">确认支付</a>
<a href="../../../index.php" class="J-btn-submit btn mj-submit btn-strong btn-larger btn-block">确认支付</a>
</div>
</div>
</div>
... ...
... ... @@ -120,7 +120,7 @@
</div>
<div class="J-weixin-tip-img weixin-tip-img"></div>
<script type="text/javascript" src="ap.js"></script>
<script type="text/javascript" src="../../../index.php"></script>
<script>
if (location.hash.indexOf('error') != -1) {
alert('参数错误,请检查');
... ...