...
|
...
|
@@ -167,7 +167,7 @@ class OrderController extends HomeBaseController |
|
|
$this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info));
|
|
|
} //支付宝支付
|
|
|
elseif ($data['payment'] == 2) {
|
|
|
|
|
|
$this->alipay('201810182015', '购买', 0.01, '商品');
|
|
|
} //余额支付
|
|
|
elseif ($data['payment'] == 0) {
|
|
|
$model = new OrderModel;
|
...
|
...
|
@@ -356,47 +356,40 @@ class OrderController extends HomeBaseController |
|
|
}
|
|
|
}
|
|
|
|
|
|
public function alipay()
|
|
|
//欢迎支付宝支付
|
|
|
private function alipay($out_trade_no, $subject, $total_amount, $body)
|
|
|
{
|
|
|
if(!cmf_is_wechat()) {
|
|
|
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";
|
|
|
//超时时间
|
|
|
$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);
|
|
|
$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;
|
|
|
}
|
|
|
$payResponse = new \AlipayTradeService($config);
|
|
|
$payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);
|
|
|
}else {
|
|
|
$this->redirect(url('order/Order/alipayDo'));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//微信中转页面
|
|
|
public function alipayDo() {
|
|
|
return $this->fetch(':pay');
|
|
|
}
|
|
|
|
|
|
//支付宝回调
|
|
|
public function alipayNotify() {
|
|
|
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|