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

支付宝

@@ -168,7 +168,7 @@ class OrderController extends HomeBaseController @@ -168,7 +168,7 @@ class OrderController extends HomeBaseController
168 $this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info)); 168 $this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info));
169 } //支付宝支付 169 } //支付宝支付
170 elseif ($data['payment'] == 2) { 170 elseif ($data['payment'] == 2) {
171 - echo json_encode(['msg'=>'支付宝', 'url'=>url('order/Order/temp',['oid'=>$oid,'step'=>1]), 'code'=>20000]); 171 + echo json_encode(['msg' => '支付宝', 'url' => url('order/Order/temp', ['oid' => $oid, 'step' => 1]), 'code' => 20000]);
172 exit(); 172 exit();
173 } //余额支付 173 } //余额支付
174 elseif ($data['payment'] == 0) { 174 elseif ($data['payment'] == 0) {
@@ -354,17 +354,18 @@ class OrderController extends HomeBaseController @@ -354,17 +354,18 @@ class OrderController extends HomeBaseController
354 { 354 {
355 $pay = new \Payment(); 355 $pay = new \Payment();
356 $return = $pay->handleNotify(); 356 $return = $pay->handleNotify();
357 - if(!empty($return)) { 357 + if (!empty($return)) {
358 $order = new OrderModel; 358 $order = new OrderModel;
359 $order->orderCallBack($return['attach'], $return['total_fee']); 359 $order->orderCallBack($return['attach'], $return['total_fee']);
360 } 360 }
361 } 361 }
362 362
363 //微信支付宝中转页面 363 //微信支付宝中转页面
364 - public function temp() {  
365 - if(cmf_is_wechat()) { 364 + public function temp()
  365 + {
  366 + if (cmf_is_wechat()) {
366 return $this->fetch(':temp'); 367 return $this->fetch(':temp');
367 - }else { 368 + } else {
368 $request = request(); 369 $request = request();
369 $oid = $request->param('oid'); 370 $oid = $request->param('oid');
370 $step = $request->param('step'); 371 $step = $request->param('step');
@@ -380,9 +381,9 @@ class OrderController extends HomeBaseController @@ -380,9 +381,9 @@ class OrderController extends HomeBaseController
380 ->join('activity a', 'o.activity_id=a.id') 381 ->join('activity a', 'o.activity_id=a.id')
381 ->join('activity_schedule s ', 'o.schedule_id=s.id') 382 ->join('activity_schedule s ', 'o.schedule_id=s.id')
382 ->where(['o.id' => $oid])->find(); 383 ->where(['o.id' => $oid])->find();
383 - if($step == 1) {  
384 - $total_amount = Db::name('order_info')->where(['id'=>$oid])->value('order_amount');  
385 - }elseif ($step == 2) { 384 + if ($step == 1) {
  385 + $total_amount = Db::name('order_info')->where(['id' => $oid])->value('order_amount');
  386 + } elseif ($step == 2) {
386 $num = Db::name('order_detail')->where(['oid' => $oid, 'status' => ['neq', 2]])->count(); 387 $num = Db::name('order_detail')->where(['oid' => $oid, 'status' => ['neq', 2]])->count();
387 if ($info['status'] == 1) { 388 if ($info['status'] == 1) {
388 if ($info['order_type'] == 0) { 389 if ($info['order_type'] == 0) {
@@ -398,17 +399,17 @@ class OrderController extends HomeBaseController @@ -398,17 +399,17 @@ class OrderController extends HomeBaseController
398 $order_amount = 0; 399 $order_amount = 0;
399 } 400 }
400 $total_amount = $order_amount; 401 $total_amount = $order_amount;
401 - }else { 402 + } else {
402 return false; 403 return false;
403 } 404 }
404 - if(!cmf_is_wechat()) { 405 + if (!cmf_is_wechat()) {
405 header("Content-type: text/html; charset=utf-8"); 406 header("Content-type: text/html; charset=utf-8");
406 require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php'; 407 require_once EXTEND_PATH . '/alipay/wappay/service/AlipayTradeService.php';
407 require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php'; 408 require_once EXTEND_PATH . '/alipay/wappay/buildermodel/AlipayTradeWapPayContentBuilder.php';
408 require EXTEND_PATH . '/alipay/config.php'; 409 require EXTEND_PATH . '/alipay/config.php';
409 - $out_trade_no = $info['order_sn'].$step;  
410 - $subject = '支付宝支付';  
411 - $body = $info['name'].'('.date('Y-m-d', $info['start_time']).')'; 410 + $out_trade_no = $info['order_sn'] . $step;
  411 + $subject = $info['name'] . '(' . date('Y-m-d', $info['start_time']) . ')';
  412 + $body = $info['name'] . '(' . date('Y-m-d', $info['start_time']) . ')';
412 //超时时间 413 //超时时间
413 $timeout_express = "1m"; 414 $timeout_express = "1m";
414 415
@@ -421,13 +422,14 @@ class OrderController extends HomeBaseController @@ -421,13 +422,14 @@ class OrderController extends HomeBaseController
421 422
422 $payResponse = new \AlipayTradeService($config); 423 $payResponse = new \AlipayTradeService($config);
423 $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']); 424 $payResponse->wapPay($payRequestBuilder, $config['return_url'], $config['notify_url']);
424 - }else { 425 + } else {
425 $this->redirect(url('order/Order/alipayDo')); 426 $this->redirect(url('order/Order/alipayDo'));
426 } 427 }
427 } 428 }
428 429
429 //支付宝回调 430 //支付宝回调
430 - public function alipayNotify() { 431 + public function alipayNotify()
  432 + {
431 433
432 } 434 }
433 435