shish 3 年之前
父節點
當前提交
8e66dfc621
共有 2 個文件被更改,包括 13 次插入13 次删除
  1. 9 9
      app-ghs/controllers/ProductController.php
  2. 4 4
      biz-ghs/product/services/ProductService.php

+ 9 - 9
app-ghs/controllers/ProductController.php

@@ -118,7 +118,7 @@ class ProductController extends BaseController
         if ($version == 0) {
             util::fail('请先升级版本到1.0.70以上');
         }
-        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $classInfo = ItemClassClass::getGhsItemClassAll($this->mainId);
         $mainId = $this->mainId ?? 0;
         $where['mainId'] = $mainId;
         if ($py) {
@@ -136,7 +136,7 @@ class ProductController extends BaseController
         $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,presellDate,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
         $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
-        $data = ProductService::assembleItemData($classIds, $itemInfoData, true);
+        $data = ProductService::assembleItemData($classInfo, $itemInfoData, true);
         util::success($data);
     }
 
@@ -148,7 +148,7 @@ class ProductController extends BaseController
         if ($version == 0) {
             util::fail('请先升级版本到1.0.70以上');
         }
-        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $classInfo = ItemClassClass::getGhsItemClassAll($this->mainId);
         $mainId = $this->mainId ?? 0;
         $where['mainId'] = $mainId;
         if ($py) {
@@ -166,7 +166,7 @@ class ProductController extends BaseController
         $field = 'id,py,cover,name,ratio,cost,addPrice,classId,skMore,skPrice,itemId,smallUnit,smallRatio,presellDate,bigUnit,smallUnit,ratioType,variety,price,stock,stockWarning,discountPrice,presell,presellDate';
         $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
-        $data = ProductService::assembleData($classIds, $itemInfoData, true);
+        $data = ProductService::assembleData($classInfo, $itemInfoData, true);
         util::success($data);
     }
 
@@ -185,15 +185,15 @@ class ProductController extends BaseController
         //获取所有当前供货商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
         //中央ID
-        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $classInfo = ItemClassClass::getGhsItemClassAll($this->mainId);
 
         $where['mainId'] = $this->mainId;
         if ($py) {
             $pyName = strtolower($py);
             $where['py'] = $pyName;
         }
+        //改价和全部库存列表
         if ($requestType == 'hasStock') {
-            //改价只显示库存大于0的
             $where['stock>'] = 0;
         }
         if (!empty($status)) {
@@ -222,7 +222,7 @@ class ProductController extends BaseController
         }
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
 
-        $data = ProductService::assembleItemData($classIds, $itemInfoData, true);
+        $data = ProductService::assembleItemData($classInfo, $itemInfoData, true);
 
         util::success($data);
     }
@@ -241,7 +241,7 @@ class ProductController extends BaseController
         //获取所有当前供货商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
         //中央ID
-        $classIds = ItemClassClass::getGhsItemClassAll($this->mainId);
+        $classInfo = ItemClassClass::getGhsItemClassAll($this->mainId);
 
         $where['mainId'] = $this->mainId;
         if ($py) {
@@ -278,7 +278,7 @@ class ProductController extends BaseController
         }
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData, $level);
 
-        $data = ProductService::assembleData($classIds, $itemInfoData, true);
+        $data = ProductService::assembleData($classInfo, $itemInfoData, true);
 
         util::success($data);
     }

+ 4 - 4
biz-ghs/product/services/ProductService.php

@@ -25,7 +25,7 @@ class ProductService extends BaseService
     const PRESELL_CLASS_ID = '-3';
 
     //组装分类花材数据
-    public static function assembleItemData($classIds, $itemInfoData, $showTodayDiscount = false)
+    public static function assembleItemData($classInfo, $itemInfoData, $showTodayDiscount = false)
     {
         $itemGroup = [];
         $tjItem = [];
@@ -57,7 +57,7 @@ class ProductService extends BaseService
 
         $classData = [];
 
-        foreach ($classIds as $classVal) {
+        foreach ($classInfo as $classVal) {
             $classId = $classVal['id'];
             $className = $classVal['name'] ?? '';
             $print = $classVal['print'] ?? 1;
@@ -105,7 +105,7 @@ class ProductService extends BaseService
     }
 
     //组装分类花材数据
-    public static function assembleData($classIds, $itemInfoData, $showTodayDiscount = false)
+    public static function assembleData($classInfo, $itemInfoData, $showTodayDiscount = false)
     {
         //今日特价
         $tjItem = [];
@@ -134,7 +134,7 @@ class ProductService extends BaseService
 
         $classData = [];
 
-        foreach ($classIds as $classVal) {
+        foreach ($classInfo as $classVal) {
             $classId = $classVal['id'];
             $className = $classVal['name'] ?? '';
             $print = $classVal['print'] ?? 1;