sunhao %!s(int64=5) %!d(string=hace) años
padre
commit
8786177822
Se han modificado 1 ficheros con 9 adiciones y 9 borrados
  1. 9 9
      app/Http/Controllers/Admin/OrderController.php

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

1306
                 DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
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
             if($use_b_gift>0 && empty($order_b_gift_ids) ){
1310
             if($use_b_gift>0 && empty($order_b_gift_ids) ){
1311
                 $b_gifts = DB::table('customer_month_gift')->where('mtime', $mdate)->where('type', 1)->get();
1311
                 $b_gifts = DB::table('customer_month_gift')->where('mtime', $mdate)->where('type', 1)->get();
1312
                 $b_gifts = json_decode(json_encode($b_gifts),true);
1312
                 $b_gifts = json_decode(json_encode($b_gifts),true);
1390
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1390
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1391
                 if(!empty($order_gifts)){
1391
                 if(!empty($order_gifts)){
1392
                     $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
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
                     if($order_m_gift_id>0){
1394
                     if($order_m_gift_id>0){
1395
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1395
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1396
                         DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
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
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1476
                 $order_gifts = DB::table('order_goods_skus')->where('is_del', 0)->where('order_id', $id)->where('gift_id','>',0)->lists('gift_id');
1477
                 if(!empty($order_gifts)){
1477
                 if(!empty($order_gifts)){
1478
                     $order_m_gift_id = DB::table('customer_month_gift')->whereIn('id', $order_gifts)->where('type', 0)->pluck('id');
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
                     if($order_m_gift_id>0){
1480
                     if($order_m_gift_id>0){
1481
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1481
                         DB::table('order_goods_skus')->where('gift_id', $order_m_gift_id)->where('order_id', $id)->update(['is_del'=>1]);
1482
                         DB::table('customer_gift_receives')->where('order_id', $id)->where('gift_id', $order_m_gift_id)->update(['is_del'=>1]);
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