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

赠送优惠券

@@ -165,18 +165,14 @@ class OrderController extends HomeBaseController @@ -165,18 +165,14 @@ class OrderController extends HomeBaseController
165 'total_fee' => $final_price 165 'total_fee' => $final_price
166 ]; 166 ];
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 - }  
169 -  
170 - //支付宝支付 168 + } //支付宝支付
171 elseif ($data['payment'] == 2) { 169 elseif ($data['payment'] == 2) {
172 170
173 - }  
174 -  
175 - //余额支付 171 + } //余额支付
176 elseif ($data['payment'] == 0) { 172 elseif ($data['payment'] == 0) {
177 $model = new OrderModel; 173 $model = new OrderModel;
178 if ($model->orderCallBack($oid)) { 174 if ($model->orderCallBack($oid)) {
179 - echo json_encode(['msg' => '下单成功', 'code' => 20000, 'url'=>url('user/Center/orderDetail', ['oid' => $oid])]); 175 + echo json_encode(['msg' => '下单成功', 'code' => 20000, 'url' => url('user/Center/orderDetail', ['oid' => $oid])]);
180 exit(); 176 exit();
181 } else { 177 } else {
182 echo json_encode(['msg' => '下单失败', 'code' => 40000]); 178 echo json_encode(['msg' => '下单失败', 'code' => 40000]);
@@ -236,7 +232,7 @@ class OrderController extends HomeBaseController @@ -236,7 +232,7 @@ class OrderController extends HomeBaseController
236 if ($info['order_type'] == 1) { 232 if ($info['order_type'] == 1) {
237 Db::name('order_log')->where(['oid' => $oid])->update(['order_amount' => $order_amount]); 233 Db::name('order_log')->where(['oid' => $oid])->update(['order_amount' => $order_amount]);
238 } 234 }
239 - echo json_encode(['msg' => '支付成功', 'code' => 20000, 'url'=>url('user/Center/orderDetail', ['oid' => $oid])]); 235 + echo json_encode(['msg' => '支付成功', 'code' => 20000, 'url' => url('user/Center/orderDetail', ['oid' => $oid])]);
240 exit(); 236 exit();
241 } else { 237 } else {
242 echo json_encode(['msg' => '支付失败', 'code' => 40000]); 238 echo json_encode(['msg' => '支付失败', 'code' => 40000]);
@@ -330,7 +326,7 @@ class OrderController extends HomeBaseController @@ -330,7 +326,7 @@ class OrderController extends HomeBaseController
330 exit(); 326 exit();
331 } 327 }
332 //判断用户余额能否支持余额支付 328 //判断用户余额能否支持余额支付
333 - if($payment == 0) { 329 + if ($payment == 0) {
334 if (Db::name('user')->where(['id' => session('user.id')])->value('balance') < $finalPrice) { 330 if (Db::name('user')->where(['id' => session('user.id')])->value('balance') < $finalPrice) {
335 echo json_encode(['msg' => '您的余额不足,请选择其他支付方式', 'code' => 40000]); 331 echo json_encode(['msg' => '您的余额不足,请选择其他支付方式', 'code' => 40000]);
336 exit(); 332 exit();
@@ -341,11 +337,12 @@ class OrderController extends HomeBaseController @@ -341,11 +337,12 @@ class OrderController extends HomeBaseController
341 //微信支付 337 //微信支付
342 private function wxPay($info) 338 private function wxPay($info)
343 { 339 {
344 - $pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee']); 340 + $pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee'] * 100);
345 return $pay->pay(); 341 return $pay->pay();
346 } 342 }
347 343
348 - public function notify() { 344 + public function notify()
  345 + {
349 $pay = new \Payment(); 346 $pay = new \Payment();
350 $pay->handleNotify(); 347 $pay->handleNotify();
351 } 348 }