Ver Fonte

1. fix bug 2. 更新

shizhongqi há 3 meses atrás
pai
commit
5910af0a9a

+ 1 - 1
app-ghs/controllers/ItemController.php

@@ -503,7 +503,6 @@ class ItemController extends BaseController
             }
         }
         $level = $custom->level ?? 1;
-        $field = '*';
 
         //只查我负责的花材
         $globalCgMyCharge = $get['globalCgMyCharge'] ?? 0;
@@ -537,6 +536,7 @@ class ItemController extends BaseController
             }
         }
 
+        $field = '*';
         $result = ProductClass::getList($field, $where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC]);
         $list = $result['list'] ?? [];
         if ($requestType == 'hasStockList') {

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

@@ -389,7 +389,7 @@ class ProductController extends BaseController
         $itemInfoData = [];
         if ($requestType == 'hasStockList') {
             //有库存的花材列表
-            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore';
+            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore,limitBuy';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             if (!empty($itemInfoData)) {
                 foreach ($itemInfoData as $key => $val) {
@@ -401,7 +401,7 @@ class ProductController extends BaseController
             }
         } elseif ($requestType == 'hideItem') {
             //隐藏花材列表
-            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore';
+            $field = 'id,py,cover,name,classId,itemId,price,skPrice,hjPrice,stock,onStock,cost,avCost,addPrice,hjAddPrice,skMore,limitBuy';
             $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';
@@ -414,7 +414,7 @@ class ProductController extends BaseController
             $itemInfoData = ProductClass::changeStockGroup($itemInfoData, $level);
         } elseif ($requestType == 'kd') {
             //开单的花材列表
-            $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,hjDiscountPrice,skDiscountPrice,discountPrice,stock,weight,stockWarning,presell,ratioType,smallUnit,smallRatio,bigUnit,ratio,frontHide,reachNum,reachNumDiscount';
+            $field = 'id,py,cover,name,cost,itemId,classId,skPrice,variety,price,hjPrice,hjDiscountPrice,skDiscountPrice,discountPrice,stock,weight,stockWarning,presell,ratioType,smallUnit,smallRatio,bigUnit,ratio,frontHide,reachNum,reachNumDiscount,limitBuy';
             $itemInfoData = ProductClass::getAllByCondition($where, ['inTurn' => SORT_DESC, 'actualSold' => SORT_DESC], $field);
             $itemInfoData = ProductClass::kdItemGroup($itemInfoData, $level, $custom);
         } elseif ($requestType == 'book') {

+ 0 - 7
biz-ghs/item/models/ItemClass.php

@@ -1,13 +1,7 @@
 <?php
-/**
- * User: admin
- * Date Time: 2021/1/13 14:13
- */
-
 namespace bizGhs\item\models;
 
 use bizGhs\base\models\Base;
-use bizGhs\item\classes\ItemClassClass;
 
 class ItemClass extends Base
 {
@@ -15,5 +9,4 @@ class ItemClass extends Base
     {
         return 'xhGhsItemClass';
     }
-
 }

+ 7 - 3
biz-hd/product/classes/ProductClass.php

@@ -435,7 +435,7 @@ class ProductClass extends BaseClass
      * @param $customId 零售xhCustom表的id
      * @param $num
      */
-    public static function handleLimitBuy($product, $customId, $num)
+    public static function handleLimitBuy($product, $customId, $num, $doCache = true)
     {
         $limitBuy = $product['limitBuy'];
         if ($limitBuy <= 0) {
@@ -458,7 +458,9 @@ class ProductClass extends BaseClass
 
                 util::error(-1, '累计已超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$lastNum - $limitBuy]);
             }
-            Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $lastNum]);
+            if ($doCache) {
+                Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $lastNum]);
+            }
         } else {
             self::recordLimitBuyRollbackSnapshot($productId, $customId, false, 0);
             if ($num > $limitBuy) {
@@ -469,7 +471,9 @@ class ProductClass extends BaseClass
                 }
                 util::error(-1, '超出限购数', ['productId'=>$productId, 'limitBuy'=>$limitBuy, 'exceed'=>$num - $limitBuy]);
             }
-            Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $num]);
+            if ($doCache) {
+                Yii::$app->redis->executeCommand('HSET', [$limitKey, $customId, $num]);
+            }
         }
     }