shish 10 hours ago
parent
commit
400aeb07ca
2 changed files with 8 additions and 20 deletions
  1. 1 6
      app-ghs/controllers/OrderController.php
  2. 7 14
      biz-ghs/product/classes/ProductClass.php

+ 1 - 6
app-ghs/controllers/OrderController.php

@@ -1621,15 +1621,12 @@ class OrderController extends BaseController
                     'kdPrice' => $currentPrice,
                 ];
             } else {
-
                 $limitBuy = $systemInfo['limitBuy'] ?? 0;
                 $bigNum = $currentProduct['bigNum'] ?? 0;
-                if ($limitBuy == 1) {
+                if ($limitBuy > 0) {
                     if ($bigNum > 0) {
-
                         $addPriceMap['couldDiscount'] = 0;
                         $orgPrice = ProductClass::getFinalPrice($systemInfo, $level, $priceMap, $addPriceMap);
-
                         //限购在这里开发,关键词 xg_develop
                         $productList[$ptKey]['price'] = $orgPrice;
                         if ($currentPrice > $orgPrice) {
@@ -1663,10 +1660,8 @@ class OrderController extends BaseController
                         }
                     }
                 }
-
             }
         }
-
         //解决开单提交订单时,别人修改价格,造成提交价格不是真实卖价问题!!
         if ($dealPrice == 0) {
             if (!empty($diff)) {

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

@@ -366,7 +366,6 @@ class ProductClass extends BaseClass
             $list[$k]['smallNum'] = $stockInfo['smallNum'];
 
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
-            $list[$k]['originPrice'] = $list[$k]['price']; //原始价
             $list[$k]['price'] = $price;
             $list[$k]['bigPrice'] = $price;
             $smallRatio = $v['smallRatio'] ?? 0;
@@ -810,9 +809,9 @@ class ProductClass extends BaseClass
         $hjDiscountPrice = $product['hjDiscountPrice'] ?? 0;
         $skDiscountPrice = $product['skDiscountPrice'] ?? 0;
         $limitBuy = $product['limitBuy'];
-        //后台开单,如果花材限购的,则不考虑特价,只取原价
-        $couldDiscount = $param['couldDiscount'] ?? 1;
-        if($couldDiscount == 1){
+        //此参数用于后台开单,如果花材限购的,则不考虑特价,只取原价
+        $couldDiscount = $params['couldDiscount'] ?? 1;
+        if($couldDiscount == 1) {
             if ($discountPrice > 0) {
                 $oldPrice = $price;
                 if ($level == 0) {
@@ -841,7 +840,6 @@ class ProductClass extends BaseClass
                 }
             }
         }
-
         //满多少数量,再优惠多少钱
         $reachNum = $product['reachNum'] ?? 0;
         $reachNumDiscount = $product['reachNumDiscount'] ?? 0;
@@ -1470,7 +1468,6 @@ class ProductClass extends BaseClass
         $book = $moreParams['book'] ?? 0;
         $customShopAdminId = $moreParams['customShopAdminId'] ?? 0;
         $custom = $moreParams['custom'] ?? [];
-        $skipLimitBuy = $moreParams['skipLimitBuy'] ?? false;
         //不同等级对应 price addPrice
         $priceMap = CustomClass::$levelPriceKeyMap;
         //这个参数应该是要作废的,但下面加的参数是有用的,多处要同步修改,关键词 abandon_add_price_map ,ssh 20260116
@@ -1509,16 +1506,12 @@ class ProductClass extends BaseClass
                 if ($book == 1 && $customShopAdminId > 0) {
                     $itemPrice = 0.1;
                 } else {
-                    $priceBuyNum = $skipLimitBuy ? 0 : $itemNum;
-                    $totalBuyNum = 0;
-                    if ($skipLimitBuy == false) {
-                        $limitKey = self::LIMIT_BUY_KEY . $ghsProductId;
-                        $hasBuyNum = Yii::$app->redis->executeCommand('HGET', [$limitKey, $custom['id']]);
-                        $totalBuyNum = $itemNum + ($hasBuyNum == null ? 0 : $hasBuyNum); // 已购买总数量
-                    }
+                    $limitKey = self::LIMIT_BUY_KEY . $ghsProductId;
+                    $hasBuyNum = Yii::$app->redis->executeCommand('HGET', [$limitKey, $custom['id']]);
+                    $hasBuyNum = $itemNum + ($hasBuyNum == null ? 0 : $hasBuyNum); // 已购买总数量
 
                     //今日特价、会员价
-                    $itemPrice = self::getFinalPrice($currentGhsProduct, $level, $priceMap, $addPriceMap, $changePrice, $priceBuyNum, $totalBuyNum);
+                    $itemPrice = self::getFinalPrice($currentGhsProduct, $level, $priceMap, $addPriceMap, $changePrice, $itemNum, $hasBuyNum);
                 }
                 $thisPrice = $itemPrice;