Browse Source

隐藏功能

shish 2 years ago
parent
commit
36b0ae23ed
2 changed files with 21 additions and 31 deletions
  1. 10 31
      app-ghs/controllers/ProductController.php
  2. 11 0
      biz-ghs/product/classes/ProductClass.php

+ 10 - 31
app-ghs/controllers/ProductController.php

@@ -211,23 +211,17 @@ class ProductController extends BaseController
             $custom = CustomClass::getById($customId, true);
             $level = $custom->level ?? 1;
         }
-
+        $notShowFrontHide = ProductClass::getNotShowFrontHideMainIds();
         $itemInfoData = [];
         if ($requestType == 'hasStockList') {
             //有库存的花材列表
             $field = 'id,py,name,classId,itemId,price,skPrice,hjPrice,stock';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
         } elseif ($requestType == 'changePrice') {
-            //只有花悠星、勇记、丽子鲜花、锦绣 显示隐藏按钮功能,其他人不显示。frontHide
-            if (getenv('YII_ENV', 'local') == 'production') {
-                $showFrontHide = [7615, 7756, 1496, 50, 4750, 7779, 8776];
+            if (in_array($this->mainId, $notShowFrontHide)) {
+                $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,presell';
             } else {
-                $showFrontHide = [644];
-            }
-            if (in_array($this->mainId, $showFrontHide)) {
                 $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,presell,frontHide';
-            } else {
-                $field = 'id,py,cover,name,cost,itemId,classId,addPrice,skPrice,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,skMore,hjAddPrice,addPrice,variety,price,hjPrice,stock,presell';
             }
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::changePriceGroup($itemInfoData, $level);
@@ -243,16 +237,10 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::kdItemGroup($itemInfoData, $level);
         } elseif ($requestType == 'itemList') {
             //花材列表
-            if (getenv('YII_ENV', 'local') == 'production') {
-                $showFrontHide = [7615, 7756, 1496, 50, 4750, 7779, 8776];
+            if (in_array($this->mainId, $notShowFrontHide)) {
+                $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,stock,actualSold,status,presell';
             } else {
-                $showFrontHide = [644];
-            }
-            if (in_array($this->mainId, $showFrontHide)) {
-                //只有花悠星、勇记、丽子鲜花、绵绣 显示隐藏按钮功能,其他人不显示。frontHide
                 $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,stock,actualSold,status,presell,frontHide';
-            } else {
-                $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,discountPrice,hjDiscountPrice,skDiscountPrice,stock,actualSold,status,presell';
             }
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::itemListGroup($itemInfoData, $level);
@@ -282,8 +270,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::simpleGroup($itemInfoData, $level);
         } elseif ($requestType == 'check') {
             //盘点花材列表
-            if (in_array($this->mainId, [52, 1459, 2126, 2128])) {
-                //惠雅鲜花的不列出frontHide字段,因为他花材太多很慢了
+            if (in_array($this->mainId, $notShowFrontHide)) {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio';
             } else {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio,frontHide';
@@ -291,8 +278,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::checkItemGroup($itemInfoData, $level);
         } elseif ($requestType == 'break') {
-            //报损花材
-            if (in_array($this->mainId, [52, 1459, 2126, 2128])) {
+            if (in_array($this->mainId, $notShowFrontHide)) {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio';
             } else {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio,frontHide';
@@ -305,9 +291,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::partItemGroup($itemInfoData, $level);
         } elseif ($requestType == 'stockOut') {
-            //出库花材
-            if (in_array($this->mainId, [52, 1459, 2126, 2128])) {
-                //惠雅鲜花的不列出frontHide字段,因为他花材太多很慢了
+            if (in_array($this->mainId, $notShowFrontHide)) {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio,smallRatio';
             } else {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,stockWarning,presell,ratioType,smallUnit,bigUnit,ratio,smallRatio,frontHide';
@@ -315,9 +299,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::stockOutGroup($itemInfoData, $level);
         } elseif ($requestType == 'cg') {
-            //采购花材
-            if (in_array($this->mainId, [52, 1459, 2126, 2128])) {
-                //惠雅鲜花的不列出frontHide字段,因为他花材太多很慢了
+            if (in_array($this->mainId, $notShowFrontHide)) {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,presell,ratioType,smallUnit,bigUnit,ratio,weight';
             } else {
                 $field = 'id,py,cover,name,itemId,classId,variety,price,discountPrice,stock,presell,ratioType,smallUnit,bigUnit,ratio,weight,frontHide';
@@ -325,9 +307,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::cgItemGroup($itemInfoData, $level);
         } elseif ($requestType == 'warning') {
-            //库存预警
-            if (in_array($this->mainId, [52, 1459, 2126, 2128])) {
-                //惠雅鲜花的不列出frontHide字段,因为他花材太多很慢了
+            if (in_array($this->mainId, $notShowFrontHide)) {
                 $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,discountPrice,stock,actualSold,presell,bigUnit,stockWarning,status';
             } else {
                 $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,discountPrice,stock,actualSold,presell,bigUnit,stockWarning,status,frontHide';
@@ -342,7 +322,6 @@ class ProductController extends BaseController
         }
         $data = ProductService::assembleItemData($classInfo, $itemInfoData);
         util::success($data);
-
     }
 
     //取出今天有入库的花材 ssh 20221224

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

@@ -41,6 +41,17 @@ class ProductClass extends BaseClass
     const LOCK_PRICE = 'lock_price'; //改价锁
     const LOCK_CHECK_STOCK = 'lock_check_stock'; //判断库存
 
+    public static function getNotShowFrontHideMainIds()
+    {
+        if (getenv('YII_ENV', 'local') == 'production') {
+            //惠雅、花样年华不显示隐藏按钮
+            $notShowFrontHide = [52, 1459, 2126, 2128, 1553];
+        } else {
+            $notShowFrontHide = [];
+        }
+        return $notShowFrontHide;
+    }
+
     //添加花材的根方法 ssh 20230224
     public static function addBaseData($data)
     {