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

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

@@ -494,7 +494,10 @@ class OrderController extends Controller
494 494
         foreach($gift_info as $k=>$v){
495 495
             //获取礼品信息
496 496
             $goods_name = Goods::where('id', $v['goods_id'])->pluck('name');
497
-            $sku = GoodsSkus::where('id', $v['sku_id'])->first();
497
+            $sku = GoodsSkus::where('id', $v['sku_id'])->where('is_del', 0)->where(function($query){
498
+                $query->where('is_white', 1)->orWhere('quantity','>',0);
499
+            })->first();
500
+            if(empty($sku)) continue;
498 501
             $data = array();
499 502
             $data['id'] = $v['id'];
500 503
             $data['goods_name'] = $goods_name;
@@ -881,7 +884,10 @@ class OrderController extends Controller
881 884
         foreach($gift_info as $k=>$val){
882 885
             //获取礼品信息
883 886
             $goods_name = Goods::where('id', $val['goods_id'])->pluck('name');
884
-            $sku = GoodsSkus::where('id', $val['sku_id'])->first();
887
+            $sku = GoodsSkus::where('id', $val['sku_id'])->where('is_del', 0)->where(function($query){
888
+                $query->where('is_white', 1)->orWhere('quantity','>',0);
889
+            })->first();
890
+            if(empty($sku)) continue;
885 891
             $data = array();
886 892
             $data['id'] = $val['id'];
887 893
             $data['goods_name'] = $goods_name;