sunhao 5 years ago
parent
commit
8786177822
1 changed files with 9 additions and 9 deletions
  1. 9 9
      app/Http/Controllers/Admin/OrderController.php

+ 9 - 9
app/Http/Controllers/Admin/OrderController.php

@@ -1306,7 +1306,7 @@ class OrderController extends Controller
1306 1306
                 DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
1307 1307
             }
1308 1308
 
1309
-            $mdate = date('Y-m-01', strtotime($old_order['create_time']));
1309
+            $mdate = date('Y-m-01', strtotime($old_order->create_time));
1310 1310
             if($use_b_gift>0 && empty($order_b_gift_ids) ){
1311 1311
                 $b_gifts = DB::table('customer_month_gift')->where('mtime', $mdate)->where('type', 1)->get();
1312 1312
                 $b_gifts = json_decode(json_encode($b_gifts),true);
@@ -1390,14 +1390,14 @@ class OrderController extends Controller
1390 1390
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1391 1391
                 if(!empty($order_gifts)){
1392 1392
                     $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
1393
-                    $order_b_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->pluck('id');
1393
+                    $order_b_gift_ids = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->lists('id');
1394 1394
                     if($order_m_gift_id>0){
1395 1395
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1396 1396
                         DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
1397 1397
                     }
1398
-                    if($order_b_gift_id>0){
1399
-                        DB::table('order_goods_skus')->where('gift_id', $order_b_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1400
-                        DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_b_gift_id)->update(['is_del'=>1]);
1398
+                    if(!empty($order_b_gift_ids)){
1399
+                        DB::table('order_goods_skus')->whereIn('gift_id', $order_b_gift_ids)->where('order_id', $id)->update(['is_del'=>1]);
1400
+                        DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_type', 1)->update(['is_del'=>1]);
1401 1401
                     }
1402 1402
                 }
1403 1403
 
@@ -1476,14 +1476,14 @@ class OrderController extends Controller
1476 1476
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1477 1477
                 if(!empty($order_gifts)){
1478 1478
                     $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
1479
-                    $order_b_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->pluck('id');
1479
+                    $order_b_gift_ids = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 1)->lists('id');
1480 1480
                     if($order_m_gift_id>0){
1481 1481
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1482 1482
                         DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
1483 1483
                     }
1484
-                    if($order_b_gift_id>0){
1485
-                        DB::table('order_goods_skus')->where('gift_id', $order_b_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1486
-                        DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_b_gift_id)->update(['is_del'=>1]);
1484
+                    if(!empty($order_b_gift_ids)){
1485
+                        DB::table('order_goods_skus')->whereIn('gift_id', $order_b_gift_ids)->where('order_id', $id)->update(['is_del'=>1]);
1486
+                        DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_type', 1)->update(['is_del'=>1]);
1487 1487
                     }
1488 1488
                 }
1489 1489