作者 何书鹏

代码优化

@@ -601,7 +601,6 @@ class Order extends Api @@ -601,7 +601,6 @@ class Order extends Api
601 $model = new \app\api\model\Order(); 601 $model = new \app\api\model\Order();
602 $order = $model::get($order_id); 602 $order = $model::get($order_id);
603 if (!$order) $this->error('订单不存在'); 603 if (!$order) $this->error('订单不存在');
604 -// $third = Third::get(['user_id'=>$this->auth->id]);  
605 $third = Third::alias('a') 604 $third = Third::alias('a')
606 ->join('user b','b.id = a.user_id') 605 ->join('user b','b.id = a.user_id')
607 ->where('a.user_id',$order['user_id']) 606 ->where('a.user_id',$order['user_id'])
@@ -629,16 +628,14 @@ class Order extends Api @@ -629,16 +628,14 @@ class Order extends Api
629 'type' => 'wechat', 628 'type' => 'wechat',
630 'orderid' => $order['order_no'], 629 'orderid' => $order['order_no'],
631 'title' => '订单号-'.$order['order_no'], 630 'title' => '订单号-'.$order['order_no'],
632 -// 'amount' => $order['pay_price'],  
633 - 'amount' => 0.01, 631 + 'amount' => $order['pay_price'],
  632 +// 'amount' => 0.01,
634 'method' => 'miniapp', 633 'method' => 'miniapp',
635 'openid' => $openid, 634 'openid' => $openid,
636 'notifyurl' => $this->request->domain().'/api/notify/orderNotify/type/wechat', 635 'notifyurl' => $this->request->domain().'/api/notify/orderNotify/type/wechat',
637 'returnurl' => '', 636 'returnurl' => '',
638 ]; 637 ];
639 $result = Service::submitOrder($params); 638 $result = Service::submitOrder($params);
640 -// $order->pay_user_id = $this->auth->id;  
641 -// $order->isUpdate()->save();  
642 $this->success('支付信息',$result); 639 $this->success('支付信息',$result);
643 } 640 }
644 641
@@ -759,10 +756,10 @@ class Order extends Api @@ -759,10 +756,10 @@ class Order extends Api
759 $wechat = Pay::wechat($config); 756 $wechat = Pay::wechat($config);
760 $refund_no = 'LQ-'.time().mt_rand(10000,99999); 757 $refund_no = 'LQ-'.time().mt_rand(10000,99999);
761 $param = [ 758 $param = [
762 -// 'total_fee' => $order['pay_price'],  
763 -// 'refund_fee' => $order['pay_price'],  
764 - 'total_fee' => 1,  
765 - 'refund_fee' => 1, 759 + 'total_fee' => $order['pay_price'],
  760 + 'refund_fee' => $order['pay_price'],
  761 +// 'total_fee' => 1,
  762 +// 'refund_fee' => 1,
766 'out_trade_no' => $order['order_no'], 763 'out_trade_no' => $order['order_no'],
767 'out_refund_no' => $refund_no 764 'out_refund_no' => $refund_no
768 ]; 765 ];
@@ -366,7 +366,6 @@ class Rider extends Api @@ -366,7 +366,6 @@ class Rider extends Api
366 366
367 Db::startTrans(); 367 Db::startTrans();
368 try{ 368 try{
369 -// $money = 0.01;  
370 $order_sn = date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8); 369 $order_sn = date('Ymd') . substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);
371 $withdraw = Withdraw::create([ 370 $withdraw = Withdraw::create([
372 'user_id' => $user['id'], 371 'user_id' => $user['id'],
@@ -6,7 +6,7 @@ use think\queue\Job; @@ -6,7 +6,7 @@ use think\queue\Job;
6 6
7 7
8 /** 8 /**
9 - * 发送优惠券自动操作 9 + * 订单自动操作
10 */ 10 */
11 class OrderAutoOper extends BaseJob 11 class OrderAutoOper extends BaseJob
12 { 12 {