Kaynağa Gözat

花材增加上下架功能

林琦海 5 yıl önce
ebeveyn
işleme
1a2231e597

+ 12 - 1
app-ghs/controllers/ProductController.php

@@ -52,6 +52,7 @@ class ProductController extends BaseController
             }
         }
         $where['shopId'] = $shopId;
+        $where['delStatus'] = 0;
 
         $itemInfoData = ProductClass::getAllByCondition($where, ['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC], "*");
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData);
@@ -207,8 +208,18 @@ class ProductController extends BaseController
         if (empty($data) || empty($type)) {
             util::fail("参数错误");
         }
-        if (in_array($type, ['inTurn', 'addPrice', 'cost', 'weight', 'ratio']))
+        if (in_array($type, ['inTurn', 'addPrice', 'cost', 'weight', 'ratio','delStatus'])){
             $data = json_decode($data, true);
+        }
+        foreach ($data as $v) {
+            if($type=='delStatus'){
+                $val = $v[$type] ?? '';
+                if(!in_array($val,[0,1])){
+                    util::fail("参数错误");
+                }
+            }
+        }
+
         foreach ($data as $v) {
             $id = $v['id'];
             $val = $v[$type] ?? '';

+ 1 - 0
app-hd/controllers/GhsProductController.php

@@ -31,6 +31,7 @@ class GhsProductController extends BaseController
         $classIds = ItemClassClass::getGhsItemClassAll($sjId);
         $where['sjId'] = $sjId;
         $where['shopId'] = $shopId;
+        $where['delStatus'] = 0;
 
         $itemInfoData = ProductClass::getAllByCondition($where,['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC],"*");
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData);

+ 1 - 0
app-hd/controllers/ProductController.php

@@ -46,6 +46,7 @@ class ProductController extends BaseController
             }
         }
         $where['shopId'] = $shopId;
+        $where['delStatus'] = 0;
 
         $itemInfoData = ProductClass::getAllByCondition($where, ['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC], "*");
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData);

+ 7 - 0
biz-ghs/product/classes/ProductClass.php

@@ -645,6 +645,13 @@ class ProductClass extends BaseClass
             $upData['inTurn'] = $data['inTurn'];
         }
 
+        if (isset($data['delStatus'])) {
+            if(!in_array($data['delStatus'],[0,1])){
+                util::fail("上下架参数错误");
+            }
+            $upData['delStatus'] = $data['delStatus'];
+        }
+
 
         //分类ID
         if (isset($data["classId"])) {