Explorar o código

做到了隐藏花材

shish hai 6 meses
pai
achega
d8c996e4fa

+ 15 - 2
app-ghs/controllers/ItemController.php

@@ -658,12 +658,25 @@ class ItemController extends BaseController
         util::success($respond);
     }
 
+    //全部隐藏的花材不再隐藏 ssh 20260201
+    public function actionAllHideShow()
+    {
+
+    }
+
+    //分类下的花材不再隐藏 sssh 20260201
+    public function actionClassItemShow()
+    {
+
+    }
+
+    //单个花材的显示和隐藏 ssh 20260201
     public function actionChangeFrontHide()
     {
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
         $status = $get['status'] ?? '';
-        if (is_numeric($status) == false) {
+        if (!is_numeric($status)) {
             util::fail('请选择方式');
         }
         $info = ItemClass::getById($id, true);
@@ -689,7 +702,7 @@ class ItemController extends BaseController
             util::fail('请选花材');
         }
         $frontHide = $post['frontHide'] ?? 0;
-        $arr = json_decode($ids,true);
+        $arr = json_decode($ids, true);
         if (empty($arr)) {
             util::fail('请选花材呢');
         }

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

@@ -322,7 +322,9 @@ class ProductController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
-
+        if($requestType == 'hideItem'){
+            $where['frontHide'] = 1;
+        }
         //客户等级
         $customId = Yii::$app->request->get('customId', 0);
         $level = 1;
@@ -344,6 +346,10 @@ class ProductController extends BaseController
                     $itemInfoData[$key]['shortCover'] = $shortCover;
                 }
             }
+        } elseif ($requestType == 'hideItem') {
+            //隐藏花材列表
+            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore';
+            $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         } elseif ($requestType == 'changePrice') {
             $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,onStock,presell,frontHide,reachNum,reachNumDiscount';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);