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

支付宝

@@ -167,7 +167,7 @@ class OrderController extends HomeBaseController @@ -167,7 +167,7 @@ class OrderController extends HomeBaseController
167 $this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info)); 167 $this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info));
168 } //支付宝支付 168 } //支付宝支付
169 elseif ($data['payment'] == 2) { 169 elseif ($data['payment'] == 2) {
170 - 170 + $this->alipay('201810182015', '购买', 0.01, '商品');
171 } //余额支付 171 } //余额支付
172 elseif ($data['payment'] == 0) { 172 elseif ($data['payment'] == 0) {
173 $model = new OrderModel; 173 $model = new OrderModel;
@@ -356,25 +356,14 @@ class OrderController extends HomeBaseController @@ -356,25 +356,14 @@ class OrderController extends HomeBaseController
356 } 356 }
357 } 357 }
358 358
359 - public function alipay() 359 + //欢迎支付宝支付
  360 + private function alipay($out_trade_no, $subject, $total_amount, $body)
360 { 361 {
361 if(!cmf_is_wechat()) { 362 if(!cmf_is_wechat()) {
362 header("Content-type: text/html; charset=utf-8"); 363 header("Content-type: text/html; charset=utf-8");
363 require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php'; 364 require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php';
364 require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php'; 365 require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
365 require EXTEND_PATH . '/alipay/config.php'; 366 require EXTEND_PATH . '/alipay/config.php';
366 - if (1 == 1) {  
367 - //商户订单号,商户网站订单系统中唯一订单号,必填  
368 - $out_trade_no = '20181017210243564' . rand(10000, 99999);  
369 -  
370 - //订单名称,必填  
371 - $subject = '购买';  
372 -  
373 - //付款金额,必填  
374 - $total_amount = 0.01;  
375 -  
376 - //商品描述,可空  
377 - $body = '商品';  
378 367
379 //超时时间 368 //超时时间
380 $timeout_express = "1m"; 369 $timeout_express = "1m";
@@ -387,16 +376,20 @@ class OrderController extends HomeBaseController @@ -387,16 +376,20 @@ class OrderController extends HomeBaseController
387 $payRequestBuilder->setTimeExpress($timeout_express); 376 $payRequestBuilder->setTimeExpress($timeout_express);
388 377
389 $payResponse = new \AlipayTradeService($config); 378 $payResponse = new \AlipayTradeService($config);
390 - $result = $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);  
391 - return;  
392 - } 379 + $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);
393 }else { 380 }else {
394 $this->redirect(url('order/Order/alipayDo')); 381 $this->redirect(url('order/Order/alipayDo'));
395 } 382 }
396 } 383 }
397 384
  385 + //微信中转页面
398 public function alipayDo() { 386 public function alipayDo() {
399 return $this->fetch(':pay'); 387 return $this->fetch(':pay');
400 } 388 }
401 389
  390 + //支付宝回调
  391 + public function alipayNotify() {
  392 +
  393 + }
  394 +
402 } 395 }