作者 何书鹏

代付测试

@@ -21,7 +21,7 @@ use Yansongda\Pay\Pay; @@ -21,7 +21,7 @@ use Yansongda\Pay\Pay;
21 */ 21 */
22 class Order extends Api 22 class Order extends Api
23 { 23 {
24 - protected $noNeedLogin = ['friendPay','commentOrderDetail']; 24 + protected $noNeedLogin = ['friendPay','commentOrderDetail','pay'];
25 protected $noNeedRight = ['*']; 25 protected $noNeedRight = ['*'];
26 26
27 /** 27 /**
@@ -555,12 +555,16 @@ class Order extends Api @@ -555,12 +555,16 @@ class Order extends Api
555 { 555 {
556 $order_id = $this->request->post('id'); 556 $order_id = $this->request->post('id');
557 $friend_id = $this->request->post('user_id'); 557 $friend_id = $this->request->post('user_id');
558 - if (!is_numeric($order_id) || ($friend_id && !is_numeric($friend_id))) $this->error('参数不合法'); 558 + empty($order_id) && $this->error('缺少必需参数');
559 559
560 $model = new \app\api\model\Order(); 560 $model = new \app\api\model\Order();
561 $order = $model::get($order_id); 561 $order = $model::get($order_id);
562 if (!$order) $this->error('订单不存在'); 562 if (!$order) $this->error('订单不存在');
563 - $openid = Third::get(['user_id'=>$this->auth->id]); 563 +// $openid = Third::get(['user_id'=>$this->auth->id]);
  564 + $openid = Third::alias('a')
  565 + ->join('user b','b.id = a.user_id')
  566 + ->field('a.openid')
  567 + ->find();
564 if (!$openid) $this->error('未注册用户'); 568 if (!$openid) $this->error('未注册用户');
565 $params = [ 569 $params = [
566 'type' => 'wechat', 570 'type' => 'wechat',
@@ -574,8 +578,8 @@ class Order extends Api @@ -574,8 +578,8 @@ class Order extends Api
574 'returnurl' => '', 578 'returnurl' => '',
575 ]; 579 ];
576 $result = Service::submitOrder($params); 580 $result = Service::submitOrder($params);
577 - $order->pay_user_id = $this->auth->id;  
578 - $order->isUpdate()->save(); 581 +// $order->pay_user_id = $this->auth->id;
  582 +// $order->isUpdate()->save();
579 $this->success('支付信息',$result); 583 $this->success('支付信息',$result);
580 } 584 }
581 585