作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

@@ -98,6 +98,11 @@ class OrderController extends HomeBaseController{ @@ -98,6 +98,11 @@ class OrderController extends HomeBaseController{
98 Db::commit(); 98 Db::commit();
99 //调起支付 99 //调起支付
100 if ($price==0){ 100 if ($price==0){
  101 + try{
  102 + Db::name('order')->where(['order_no'=>$order['order_no']])->update(['state'=>3]);
  103 + }catch (\Exception $exception){
  104 + $this->apiResponse(301,'error:'.$exception->getMessage());
  105 + }
101 $data=[ 106 $data=[
102 'state'=>2, 107 'state'=>2,
103 ]; 108 ];
@@ -226,7 +231,7 @@ class OrderController extends HomeBaseController{ @@ -226,7 +231,7 @@ class OrderController extends HomeBaseController{
226 $order=Db::name('order')->where(['order_no'=>$order_no,'state'=>2])->find(); 231 $order=Db::name('order')->where(['order_no'=>$order_no,'state'=>2])->find();
227 $openId=Db::name('users')->where('id',$order['users_id'])->find()['open_id']; 232 $openId=Db::name('users')->where('id',$order['users_id'])->find()['open_id'];
228 $body='支付'; 233 $body='支付';
229 - $price=$order['price'];//订单价格 234 + $price=$order['price']*1;//订单价格
230 $notify_url=url('order/notify','','',true);//回调地址 235 $notify_url=url('order/notify','','',true);//回调地址
231 $out_trade_no=$order_no.$this->create_noncestr(4); 236 $out_trade_no=$order_no.$this->create_noncestr(4);
232 $wxPay=new WeixinPay($openId,$out_trade_no,$body,$price,$notify_url); 237 $wxPay=new WeixinPay($openId,$out_trade_no,$body,$price,$notify_url);
@@ -103,7 +103,6 @@ class WeixinPay { @@ -103,7 +103,6 @@ class WeixinPay {
103 private function weixinapp() { 103 private function weixinapp() {
104 //统一下单接口 104 //统一下单接口
105 $unifiedorder = $this->unifiedorder(); 105 $unifiedorder = $this->unifiedorder();
106 - dump($unifiedorder);  
107 $parameters = array( 106 $parameters = array(
108 'appId' => $this->appid, //小程序ID 107 'appId' => $this->appid, //小程序ID
109 'timeStamp' => ''.time().'', //时间戳 108 'timeStamp' => ''.time().'', //时间戳