소스 검색

完善功能

gorden 9 달 전
부모
커밋
8ad8456342
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  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([