Browse Source

订单录入接口修改

sunhao 5 years ago
parent
commit
c163e3a024
1 changed files with 8 additions and 2 deletions
  1. 8 2
      app/Http/Controllers/Api/OrderController.php

+ 8 - 2
app/Http/Controllers/Api/OrderController.php

@@ -257,6 +257,9 @@ class OrderController extends Controller {
257 257
         $order['buyer_phone'] = $request->input('buyer_phone');    
258 258
         $coupon_id = (int)$request->input('coupon_id'); 
259 259
         if($coupon_id>0){
260
+            if($order['payment_type'] == 4){
261
+                return self::returnValue(['msg'=>'优惠券和充值卡不能同时使用'], 2000);
262
+            }
260 263
             $order['use_coupon'] = 1;
261 264
         }
262 265
         $order['use_b_gift'] = (int)$request->input('use_b_gift'); 
@@ -524,6 +527,9 @@ class OrderController extends Controller {
524 527
 
525 528
         $coupon_id = (int)$request->input('coupon_id'); 
526 529
         if($coupon_id>0){
530
+            if($order['payment_type'] == 4){
531
+                return self::returnValue(['msg'=>'充值卡不能和优惠券同时使用'], 2000);
532
+            }
527 533
             $order['use_coupon'] = 1;
528 534
         }
529 535
         $order['buyer_phone'] = $request->input('buyer_phone');
@@ -548,14 +554,14 @@ class OrderController extends Controller {
548 554
                 $balance = isset($customerInfo->balance) ? $customerInfo->balance : 0 ;
549 555
                 if($balance < $order['receivedAmount']){
550 556
                     //余额不足
551
-                    return self::returnValue(['msg'=>'充值卡余额不足'], 2000); 
557
+                    return self::returnValue(['msg'=>'充值卡余额不足'], 2003); 
552 558
                 }               
553 559
             }elseif($old_order->receivedAmount != $order['receivedAmount']){              
554 560
                 $customerInfo = CustomerInfo::where('phone', $deposit_phone)->first();
555 561
                 $balance = $customerInfo->balance;
556 562
                 if( $balance < $order['receivedAmount']-$old_order->receivedAmount ){
557 563
                     //余额不足
558
-                    return self::returnValue(['msg'=>'充值卡余额不足'], 2000);             
564
+                    return self::returnValue(['msg'=>'充值卡余额不足'], 2003);             
559 565
                 }
560 566
             }
561 567
         }