Browse Source

完善功能

gorden 9 months ago
parent
commit
8ad8456342
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/admin/service/goods/GoodsService.php

+ 3 - 1
app/admin/service/goods/GoodsService.php

@@ -210,7 +210,7 @@ class GoodsService
 
         $categorySuperId = $request->get('category_super_id', '');
         $categoryIds = $request->get('join_goods_category_id', []);
-        if (!empty($categorySuperId) && empty($categoryIds)) {
+        if (!empty($categorySuperId) && is_array($categoryIds)) {
             $category = SysCategory::where('category_id', $categorySuperId)->first();
             if (empty($category->category_super_path)) {
                 $category->category_super_path = '#' . $categorySuperId . '#';
@@ -218,6 +218,8 @@ class GoodsService
                 $category->category_super_path = $category->category_super_path . '#' . $categorySuperId . '#';
             }
             $categoryIds = SysCategory::where('category_super_path', 'like', '%' . $category->category_super_path)->pluck('category_id');
+        } elseif (!is_array($categoryIds)) {
+            $categoryIds = [$categoryIds];
         }
 
         $rows = Goods::with([