gorden 8 kuukautta sitten
vanhempi
säilyke
0e0ffdf403
1 muutettua tiedostoa jossa 14 lisäystä ja 15 poistoa
  1. 14 15
      app/admin/service/goods/GoodsService.php

+ 14 - 15
app/admin/service/goods/GoodsService.php

@@ -65,26 +65,25 @@ class GoodsService
     {
     {
         $categoryIds = [];
         $categoryIds = [];
         if ($category == 'GOODS') {
         if ($category == 'GOODS') {
-            $categoryIds = [6, 7, 8, 10, 11, 12];
+            $categorySuperIds = [5];
         } elseif ($category == 'SERVICE') {
         } elseif ($category == 'SERVICE') {
-            $categorySuperIds = [31, 43, 65, 30, 66, 72];
-
-            $categorys = SysCategory::whereIn('category_id', $categorySuperIds)->get()->toArray();
-            foreach ($categorys as $item) {
-                if (empty($item['category_super_path'])) {
-                    $item['category_super_path'] = '#' . $item['category_id'] . '#';
-                } else {
-                    $item['category_super_path'] = $item['category_super_path'] . '#' . $item['category_id'] . '#';
-                }
-
-                $categoryIds = SysCategory::where('category_super_path', 'like', '%' . $item['category_super_path'])->pluck('category_id');
-                $categoryIds = $categoryIds ? $categoryIds->toArray() : [];
-                $categorySuperIds = array_merge($categorySuperIds, $categoryIds);
+            $categorySuperIds = [31, 154, 42, 65, 30, 66, 72, 70];
+        }
+        $categorys = SysCategory::whereIn('category_id', $categorySuperIds)->get()->toArray();
+        foreach ($categorys as $item) {
+            if (empty($item['category_super_path'])) {
+                $item['category_super_path'] = '#' . $item['category_id'] . '#';
+            } else {
+                $item['category_super_path'] = $item['category_super_path'] . '#' . $item['category_id'] . '#';
             }
             }
 
 
-            $categoryIds = array_unique($categorySuperIds);
+            $categoryIds = SysCategory::where('category_super_path', 'like', '%' . $item['category_super_path'])->pluck('category_id');
+            $categoryIds = $categoryIds ? $categoryIds->toArray() : [];
+            $categorySuperIds = array_merge($categorySuperIds, $categoryIds);
         }
         }
 
 
+        $categoryIds = array_unique($categorySuperIds);
+
         $goods = Goods::with('sku')
         $goods = Goods::with('sku')
 //            ->where('goods_classify', $category)
 //            ->where('goods_classify', $category)
             ->when(!empty($categoryIds), function ($query) use ($categoryIds) {
             ->when(!empty($categoryIds), function ($query) use ($categoryIds) {