Jelajahi Sumber

零售成品分类不正确

sorry 5 tahun lalu
induk
melakukan
3d8022f881

+ 1 - 2
app-hd/controllers/GoodsController.php

@@ -188,8 +188,7 @@ class GoodsController extends BaseController
         //常用的GoodsId
         $oftenIds = GoodsCategoryService::getOftenIds($this->sjId);
 
-        $goodsCateData = GoodsCategoryService::getGoodsCategory($this->sjId);
-
+        $goodsCateData = GoodsCategoryService::getEnableGoodsCategory($this->sjId);
 
         //组装数据: [{classId:'','className:'',child:[{itemInfoData}]}]
         $data = GoodsCategoryService::assembleData($classIds, $goodsCateData, $goodsData, $oftenIds);

+ 12 - 0
biz-hd/goods/services/GoodsCategoryService.php

@@ -106,6 +106,18 @@ class GoodsCategoryService extends BaseService
         return $data;
     }
 
+    //获取商家下 所有启用的商品分类
+    public static function getEnableGoodsCategory($sjId)
+    {
+        $cat = CategoryService::getEnableList($sjId);
+        $where = [
+            'merchantId' => $sjId,
+            'cId' => ['in', array_column($cat, 'id')],
+        ];
+        $data = self::getAllList('cId as classId,gId', $where);
+        return $data;
+    }
+
 	//获取常用分类的 goods id  linqh 2021.04.09
     public static function getOftenIds($sjId)
     {