Parcourir la source

花店进店开单:花材列表

林琦海 il y a 5 ans
Parent
commit
17ed93315f
1 fichiers modifiés avec 12 ajouts et 15 suppressions
  1. 12 15
      app-hd/controllers/GhsProductController.php

+ 12 - 15
app-hd/controllers/GhsProductController.php

@@ -17,33 +17,30 @@ use Yii;
 class GhsProductController extends BaseController
 {
     //从零售端采购入库,查看供货商的某个门店的product
-    public function actionList()
+    public function actionIndex()
     {
         $get = Yii::$app->request->get();
         $shopId = $get['shopId']??0;
         $sjId = $get['sjId']??0;
         $py = $get['py']??'';
-
+        AdminClass::addRecentShop($shopId,$this->admin);
         //获取所有当前供应商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
         $classIds = ItemClassClass::getGhsItemClassAll($sjId);
+        $where['merchantId'] = $sjId;
+        $where['shopId'] = $shopId;
 
-        //获取供应商下所有花材ID (itemIds)
-        $itemIdsInfo = ItemService::getGhsItemIds($sjId);
-
-        $itemIds = array_column($itemIdsInfo,'itemId');
-
-        if($py){
-            $pyNameItemIds = ItemClass::getItemIdsByPyName($py);
-            $itemIds = array_intersect($itemIds,$pyNameItemIds);
-        }
-
-        $itemInfoData = ProductClass::getProductInfoByItemIds($itemIds,$shopId);
+        $itemInfoData = ProductClass::getAllByCondition($where,null,"*");
+        $itemInfoData = ProductClass::groupProductInfo($itemInfoData);
         //常用的itemIds
         $oftenItemIds = ProductClass::getOftenItemIds($shopId);
+        //获取供应商下所有花材ID (itemIds)
+        $itemIdsInfo = ItemService::getGhsItemIds($this->sjId);
+
+        //dd($itemInfoData);
         //组装数据: [{classId:'','className:'',child:[{itemInfoData}]}]
-        $data = ProductService::assembleData($classIds,$itemIdsInfo,$itemInfoData,$oftenItemIds);
-        AdminClass::addRecentShop($shopId,$this->admin);
+        $data = ProductService::assembleData($classIds, $itemIdsInfo,$itemInfoData, $oftenItemIds, '');
+
         util::success($data);
 
     }