Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev' into dev

ouyang 1 mese fa
parent
commit
8ccd74d0ad

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

@@ -1432,12 +1432,27 @@ class OrderController extends BaseController
         $addPriceMap['risePercent'] = $custom['risePercent'] ?? 0;
         $addPriceMap['risePercent'] = $custom['risePercent'] ?? 0;
 
 
         $level = $custom['level'] ?? 1;
         $level = $custom['level'] ?? 1;
+        $skipLimitBuy = !empty($shop->skCustomId) && intval($shop->skCustomId) == intval($customId);
+        $limitBuyCheckList = [];
+        foreach ($productList as $currentProduct) {
+            $limitBuyCheckList[] = [
+                'id' => $currentProduct['productId'] ?? 0,
+                'bigCount' => $currentProduct['bigNum'] ?? 0,
+                'smallCount' => $currentProduct['smallNum'] ?? 0,
+            ];
+        }
+        $limitBuyInfoList = ProductClass::getLimitBuyInfoByList($limitBuyCheckList, $customId);
+        $limitBuyInfoMap = array_column($limitBuyInfoList, null, 'id');
         foreach ($productList as $ptKey => $currentProduct) {
         foreach ($productList as $ptKey => $currentProduct) {
             $currentPrice = $currentProduct['price'] ?? 0;
             $currentPrice = $currentProduct['price'] ?? 0;
             $currentId = $currentProduct['productId'] ?? 0;
             $currentId = $currentProduct['productId'] ?? 0;
             $systemInfo = $itemInfo[$currentId] ?? [];
             $systemInfo = $itemInfo[$currentId] ?? [];
             $name = $systemInfo['name'] ?? '';
             $name = $systemInfo['name'] ?? '';
-            $systemPrice = ProductClass::getFinalPrice($systemInfo, $level, $priceMap, $addPriceMap);
+            $limitBuyInfo = $limitBuyInfoMap[$currentId] ?? [];
+            $buyNum = $skipLimitBuy ? 0 : ($limitBuyInfo['currentBuyNum'] ?? 0);
+            $hasBuyNum = $skipLimitBuy ? 0 : ($limitBuyInfo['hasBuyNum'] ?? 0);
+            $totalBuyNum = $skipLimitBuy ? 0 : bcadd($hasBuyNum, $buyNum, 2);
+            $systemPrice = ProductClass::getFinalPrice($systemInfo, $level, $priceMap, $addPriceMap, 0, $buyNum, $totalBuyNum);
 
 
             if (getenv('YII_ENV') == 'production') {
             if (getenv('YII_ENV') == 'production') {
                 //苏州小蔡鲜花,几个出车,不能低于原价卖,但可以高于原价卖的
                 //苏州小蔡鲜花,几个出车,不能低于原价卖,但可以高于原价卖的
@@ -1544,6 +1559,7 @@ class OrderController extends BaseController
             try {
             try {
                 $return = OrderService::createNewOrder($post, $custom, $hasPay);
                 $return = OrderService::createNewOrder($post, $custom, $hasPay);
                 $transaction->commit();
                 $transaction->commit();
+                ProductClass::clearLimitBuyRollbackSnapshot();
             } catch (\Exception $exception) {
             } catch (\Exception $exception) {
                 if ($transaction->isActive) {
                 if ($transaction->isActive) {
                     $transaction->rollBack();
                     $transaction->rollBack();
@@ -1610,6 +1626,7 @@ class OrderController extends BaseController
             }
             }
             util::success($return);
             util::success($return);
         } catch (\Exception $e) {
         } catch (\Exception $e) {
+            ProductClass::rollbackLimitBuySnapshot();
             Yii::error("下单失败原因:" . $e->getMessage());
             Yii::error("下单失败原因:" . $e->getMessage());
             noticeUtil::push("批发线下开单失败,原因:" . $e->getMessage(), '15280215347');
             noticeUtil::push("批发线下开单失败,原因:" . $e->getMessage(), '15280215347');
             if (util::isDbConcurrencyException($e)) {
             if (util::isDbConcurrencyException($e)) {

+ 26 - 1
app-ghs/controllers/PurchaseController.php

@@ -3,8 +3,10 @@
 namespace ghs\controllers;
 namespace ghs\controllers;
 
 
 use biz\ghs\classes\GhsClass;
 use biz\ghs\classes\GhsClass;
+use bizGhs\custom\classes\CustomClass;
 use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\order\services\PurchaseOrderService;
 use bizGhs\order\services\PurchaseOrderService;
+use bizGhs\product\classes\ProductClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseClass;
 use common\components\dateUtil;
 use common\components\dateUtil;
 use common\components\util;
 use common\components\util;
@@ -41,6 +43,29 @@ class PurchaseController extends BaseController
         util::success(['salt' => $salt]);
         util::success(['salt' => $salt]);
     }
     }
 
 
+    // 批发商开单限购花材信息
+    public function actionLimitBuyInfo()
+    {
+        $post = Yii::$app->request->post();
+        $customId = $post['customId'] ?? 0;
+        $list = $post['list'] ?? [];
+        if (empty($customId)) {
+            util::fail('缺少客户');
+        }
+        if (empty($list) || !is_array($list)) {
+            util::fail('请选择花材');
+        }
+
+        $custom = CustomClass::getCustom($customId);
+        if (empty($custom)) {
+            util::fail('没有找到客户');
+        }
+        CustomClass::valid($custom, $this->shopId);
+
+        $respond = ProductClass::getLimitBuyInfoByList($list, $customId);
+        util::success($respond);
+    }
+
     //待结款明细 ssh 2021.1.26
     //待结款明细 ssh 2021.1.26
     public function actionDebtList()
     public function actionDebtList()
     {
     {
@@ -113,4 +138,4 @@ class PurchaseController extends BaseController
         util::complete('确认成功');
         util::complete('确认成功');
     }
     }
 
 
-}
+}

+ 7 - 3
app-hd/controllers/GhsController.php

@@ -257,7 +257,7 @@ class GhsController extends BaseController
         $ghsInfo['packCost'] = $ghsShop->packCost ? floatval($ghsShop->packCost) : 0;
         $ghsInfo['packCost'] = $ghsShop->packCost ? floatval($ghsShop->packCost) : 0;
         $lackExpend = $ghsShop->lackExpend ? floatval($ghsShop->lackExpend) : 0;
         $lackExpend = $ghsShop->lackExpend ? floatval($ghsShop->lackExpend) : 0;
         $customId = $ghsInfo['customId'] ?? 0;
         $customId = $ghsInfo['customId'] ?? 0;
-        $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShop, $customId);
+        $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShop, $customId, 4);
         //昆明批发,需要算打包费和运费
         //昆明批发,需要算打包费和运费
         $needAddPackFreight = 1;
         $needAddPackFreight = 1;
         if (!$needAdd) {
         if (!$needAdd) {
@@ -321,6 +321,10 @@ class GhsController extends BaseController
         }
         }
         $ghsInfo['hcMap'] = $hcMap;
         $ghsInfo['hcMap'] = $hcMap;
 
 
+        //是否使用新的配送方式,关键词 sh_method_area
+        $newShMethod = dict::getNewMethodShop();
+        $ghsInfo['useNewShMethod'] = in_array($ghsShopId, $newShMethod) ? 1 : 0;
+
         util::success($ghsInfo);
         util::success($ghsInfo);
     }
     }
 
 
@@ -503,10 +507,10 @@ class GhsController extends BaseController
         $get = Yii::$app->request->get();
         $get = Yii::$app->request->get();
         $ghsId = intval($get['ghsId'] ?? 0);
         $ghsId = intval($get['ghsId'] ?? 0);
         $ghs = GhsClass::getById($ghsId);
         $ghs = GhsClass::getById($ghsId);
-        if(empty($ghs)){
+        if (empty($ghs)) {
             util::fail('没有找到批发店');
             util::fail('没有找到批发店');
         }
         }
-        if($ghs['ownMainId'] != $this->mainId){
+        if ($ghs['ownMainId'] != $this->mainId) {
             util::fail('不是你的批发店');
             util::fail('不是你的批发店');
         }
         }
         $mainId = $ghs['mainId'] ?? 0;
         $mainId = $ghs['mainId'] ?? 0;

+ 29 - 29
app-hd/controllers/NoticeController.php

@@ -192,15 +192,15 @@ class NoticeController extends PublicController
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     }
                     }
                 } else {
                 } else {
-                    //标记当天发快递方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
                     $customId = $cg->customId ?? 0;
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && $cg->sendType == 4) {
-                        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                        $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
-                    }
-                    if (isset($cg->sendType) && $cg->sendType == 0) {
-                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $current . '_' . $customId;
+
+                        // 兼容快递收运费的情况
+                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
                     }
                 }
                 }
@@ -411,15 +411,15 @@ class NoticeController extends PublicController
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     }
                     }
                 } else {
                 } else {
-                    //标记当天发快递方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
                     $customId = $cg->customId ?? 0;
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && $cg->sendType == 4) {
-                        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                        $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
-                    }
-                    if (isset($cg->sendType) && $cg->sendType == 0) {
-                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $current . '_' . $customId;
+
+                        // 兼容快递收运费的情况
+                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
                     }
                 }
                 }
@@ -579,15 +579,15 @@ class NoticeController extends PublicController
                     }
                     }
                 } else {
                 } else {
 
 
-                    //标记当天发快递方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                    //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
                     $customId = $cg->customId ?? 0;
                     $customId = $cg->customId ?? 0;
                     $current = date("Y_m_d");
                     $current = date("Y_m_d");
-                    if (isset($cg->sendType) && $cg->sendType == 4) {
-                        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                    if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                        $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
-                    }
-                    if (isset($cg->sendType) && $cg->sendType == 0) {
-                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $current . '_' . $customId;
+
+                        // 兼容快递收运费的情况
+                        $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                         Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                     }
                     }
 
 
@@ -836,18 +836,18 @@ class NoticeController extends PublicController
                                 Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                                 Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                             }
                             }
                         } else {
                         } else {
-                            //标记当天发快递方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
-                            $customId = $cg->customId ?? 0;
-                            $current = date("Y_m_d");
-                            if (isset($cg->sendType) && $cg->sendType == 4) {
-                                $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
-                                Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
-                            }
-                            if (isset($cg->sendType) && $cg->sendType == 0) {
-                                $sendKey = 'ghs_custom_today_has_get_send_cost_' . $current . '_' . $customId;
-                                Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
+                                //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                                $customId = $cg->customId ?? 0;
+                                $current = date("Y_m_d");
+                                if (isset($cg->sendType) && in_array($cg->sendType, [0, 4])) {
+                                    $key = 'ghs_custom_today_has_get_pack_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
+                                    Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+
+                                    // 兼容快递收运费的情况
+                                    $sendKey = 'ghs_custom_today_has_get_send_cost_' . $cg->sendType . '_' . $current . '_' . $customId;
+                                    Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
+                                }
                             }
                             }
-                        }
 
 
                         //微信通知
                         //微信通知
                         $saleId = $cg->saleId ?? 0;
                         $saleId = $cg->saleId ?? 0;

+ 215 - 177
app-hd/controllers/PurchaseController.php

@@ -11,6 +11,7 @@ use bizGhs\custom\classes\AccountMoneyClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\express\classes\GhsDeliveryOrderClass;
 use bizGhs\express\classes\GhsDeliveryOrderClass;
 use bizGhs\order\classes\OrderClass;
 use bizGhs\order\classes\OrderClass;
+use bizGhs\order\classes\ShMethodClass;
 use bizHd\cg\classes\CgMergeSnClass;
 use bizHd\cg\classes\CgMergeSnClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseItemClass;
 use bizHd\purchase\classes\PurchaseItemClass;
@@ -520,6 +521,9 @@ class PurchaseController extends BaseController
 
 
             $post['product'] = $productList;
             $post['product'] = $productList;
 
 
+            // xhShMethod 门店下单前保留花材合计,供后续 packCost 计算(pfLevel==0 分支会 unset itemTotalAmount)
+            $shMethodItemAmount = $post['itemTotalAmount'] ?? 0;
+
             $sendType = $post['sendType'] ?? 0;
             $sendType = $post['sendType'] ?? 0;
             $transType = $post['transType'] ?? 0;
             $transType = $post['transType'] ?? 0;
             if ($sendType == dict::getDict('sendType', 'thirdSend')) {
             if ($sendType == dict::getDict('sendType', 'thirdSend')) {
@@ -568,7 +572,7 @@ class PurchaseController extends BaseController
                     }
                     }
                 }
                 }
                 //如果已经算过一次打包费和运费了,则不再费了
                 //如果已经算过一次打包费和运费了,则不再费了
-                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
+                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType);
                 if (!$needAdd) {
                 if (!$needAdd) {
                     $packCost = 0;
                     $packCost = 0;
                     if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
                     if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
@@ -618,7 +622,7 @@ class PurchaseController extends BaseController
                 }
                 }
 
 
                 //如果已经算过一次打包费和运费了,则不再费了
                 //如果已经算过一次打包费和运费了,则不再费了
-                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
+                $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType);
                 if ($needAdd == false) {
                 if ($needAdd == false) {
                     $sendCost = 0;
                     $sendCost = 0;
                 }
                 }
@@ -627,218 +631,248 @@ class PurchaseController extends BaseController
                 //标记为昆明到地方订单
                 //标记为昆明到地方订单
                 $post['localOrder'] = 1;
                 $post['localOrder'] = 1;
             } else {
             } else {
-                //同城发货包装费和运费的计算
-                $sendCost = 0;
-                $sendDistance = 0;
-                //特别注意,这边取供货商的shop信息
-                $mapSet = ShopClass::hasIntraCity($ghsShopInfo);
-                $openIntraCity = $mapSet['openIntraCity'] ?? 0;
-                if ($sendType == dict::getDict('sendType', 'thirdSend')) {
-                    if ($openIntraCity == 2) {
-                        util::fail('不能使用跑腿');
+
+                // xhShMethod 门店:下单前按配置写入不满最低消费时的附加包装费/运费,关键词 sh_method_area
+                $newShMethod = dict::getNewMethodShop();
+                if (in_array($ghsShopId, $newShMethod)) {
+                    $shMethodBigNum = 0;
+                    foreach ($productList as $itemData) {
+                        $shMethodBigNum += floatval($itemData['bigNum'] ?? 0);
+                    }
+                    $additionalCosts = ShMethodClass::calcFee(
+                        $ghsShopId,
+                        $ghsMainId,
+                        $sendType,
+                        $shMethodItemAmount,
+                        $shMethodBigNum,
+                        $customId,
+                        $ghsInfo
+                    );
+
+                    // 如果产生了附加运费,与前面可能产生的 sendCost 进行累加或覆盖
+                    if ($additionalCosts['sendCost'] > 0) {
+                        $post['sendCost'] = bcadd($post['sendCost'] ?? 0, $additionalCosts['sendCost'], 2);
                     }
                     }
-                    if ($openIntraCity == 1) {
-                        // 生成随机订单号,不要跟原来的混起来,跑腿-销售单-
-                        $prefix = 'PT-XSD-' . $this->mainId . '-';
-                        $orderSn = $prefix . round(microtime(true) * 1000);
 
 
-                        // 使用 DeliveryQuoteUtil 获取配送报价
-                        try {
+                    // 如果产生了附加包装费,覆盖前面赋值的 packCost
+                    if ($additionalCosts['packCost'] > 0) {
+                        $post['packCost'] = $additionalCosts['packCost'];
+                    }
+                }else{
 
 
-                            if (empty($post['deliveryPlatform'])) {
-                                util::fail('请选择跑腿');
-                            }
+                    //同城发货包装费和运费的计算
+                    $sendCost = 0;
+                    $sendDistance = 0;
+                    //特别注意,这边取供货商的shop信息
+                    $mapSet = ShopClass::hasIntraCity($ghsShopInfo);
+                    $openIntraCity = $mapSet['openIntraCity'] ?? 0;
+                    if ($sendType == dict::getDict('sendType', 'thirdSend')) {
+                        if ($openIntraCity == 2) {
+                            util::fail('不能使用跑腿');
+                        }
+                        if ($openIntraCity == 1) {
+                            // 生成随机订单号,不要跟原来的混起来,跑腿-销售单-
+                            $prefix = 'PT-XSD-' . $this->mainId . '-';
+                            $orderSn = $prefix . round(microtime(true) * 1000);
+
+                            // 使用 DeliveryQuoteUtil 获取配送报价
+                            try {
+
+                                if (empty($post['deliveryPlatform'])) {
+                                    util::fail('请选择跑腿');
+                                }
 
 
-                            $quoteResult = DeliveryQuoteUtil::getDeliveryQuote([
-                                'productList' => $productList,
-                                'deliveryPlatform' => $post['deliveryPlatform'],
-                                'deliveryBracketContent' => $post['deliveryBracketContent'], // 平台多报价识别id
-                                'ghsInfo' => $ghsInfo,
-                                'custom' => $custom,
-                                'order' => [
-                                    'orderSn' => $orderSn,
-                                    'goodsType' => 1, //商品类型:0花束 1花材
-                                    'itemTotalAmount' => $post['itemTotalAmount'] ?? 0,
-                                    'remark' => $post['remark'] ?? '',
-                                ],
-                                'mainId' => $this->mainId,
-                                'productCount' => $productCount,
-                            ]);
-
-                            $sendCost = $quoteResult['sendCost'];
-                            $sendDistance = $quoteResult['sendDistance'];
-                        } catch (\Exception $e) {
-                            util::fail($e->getMessage());
+                                $quoteResult = DeliveryQuoteUtil::getDeliveryQuote([
+                                    'productList' => $productList,
+                                    'deliveryPlatform' => $post['deliveryPlatform'],
+                                    'deliveryBracketContent' => $post['deliveryBracketContent'], // 平台多报价识别id
+                                    'ghsInfo' => $ghsInfo,
+                                    'custom' => $custom,
+                                    'order' => [
+                                        'orderSn' => $orderSn,
+                                        'goodsType' => 1, //商品类型:0花束 1花材
+                                        'itemTotalAmount' => $post['itemTotalAmount'] ?? 0,
+                                        'remark' => $post['remark'] ?? '',
+                                    ],
+                                    'mainId' => $this->mainId,
+                                    'productCount' => $productCount,
+                                ]);
+
+                                $sendCost = $quoteResult['sendCost'];
+                                $sendDistance = $quoteResult['sendDistance'];
+                            } catch (\Exception $e) {
+                                util::fail($e->getMessage());
+                            }
                         }
                         }
                     }
                     }
-                }
 
 
-                $post['sendCost'] = $sendCost;
-                $post['sendDistance'] = $sendDistance;
+                    $post['sendCost'] = $sendCost;
+                    $post['sendDistance'] = $sendDistance;
 
 
-                //出车、发快递、发物流可以算包装费
-                $packCost = 0;
-                if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
-                    noticeUtil::push("走的pfLevel=0", '15280215347');
-                }
-                $itemTotalAmount = $post['itemTotalAmount'] ?? 0;
-                unset($post['itemTotalAmount']);
-                if ($sendType == dict::getDict('sendType', 'express')) {
-                    $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $itemTotalAmount);
-                    if ($needAdd) {
-                        $packCost = $ghsShopInfo->packCost ?? 0;
+                    // 出车(0)、发快递(4)、发物流可以算包装费
+                    $packCost = 0;
+                    if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
+                        noticeUtil::push("走的pfLevel=0", '15280215347');
                     }
                     }
-                }
-                $post['packCost'] = $packCost;
-            }
+                    $itemTotalAmount = $post['itemTotalAmount'] ?? 0;
+                    unset($post['itemTotalAmount']);
+
+                    // sendType == 0 或 4 都要收包装费
+                    if (in_array($sendType, [0, 4])) {
+                        $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType, $itemTotalAmount);
+                        if ($needAdd) {
+                            $packCost = $ghsShopInfo->packCost ?? 0;
+                        }
+                    }
+                    $post['packCost'] = $packCost;
 
 
-            if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
-                noticeUtil::push("包装费:" . $packCost, '15280215347');
+                }
             }
             }
 
 
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
             $respond = PurchaseService::createPurchase($post, $ghsInfo);
 
 
-            if ($sendType == 0) {
-                if (getenv('YII_ENV') == 'production') {
-                    //杭州斗南鲜花批发部,满500,10公里内免费配送,满1000,20公里免费配送
-                    if ($ghsShopId == 4608) {
-                        if ($respond->actPrice < 500) {
-                            $transaction->rollBack();
-                            util::fail('满500元支持免费配送');
-                        }
-                    }
-                    //叶上花,满500元市区免费配送
-                    if ($ghsShopId == 4804) {
-                        if ($respond->actPrice < 500) {
-                            $transaction->rollBack();
-                            util::fail('满500元支持免费配送');
-                        }
-                    }
-                    //花悠星 国恋 勇记 万丽 陆丰暂时不支持免费配送
-                    if ($ghsShopId == 7687 || $ghsShopId == 7831 || $ghsShopId == 7778 || $ghsShopId == 12003 || $ghsShopId == 38128) {
-                        util::fail('暂不支持送货上门,请选其它配送方式!');
-                    }
+            $newShMethod = dict::getNewMethodShop();
+            if (in_array($ghsShopId, $newShMethod)) {
+                // 使用 xhShMethod 配置校验配送限制,替代旧版门店硬编码规则,关键词 sh_method_area
+                $shMethodError = ShMethodClass::checkLimit(
+                    $ghsShopId,
+                    $ghsMainId,
+                    $sendType,
+                    $respond->actPrice ?? 0,
+                    $respond->bigNum ?? 0,
+                    $post['packCost'] ?? 0,
+                    $post['sendCost'] ?? 0,
+                    $post['wlName'] ?? '',
+                    $customId,
+                    $ghsInfo
+                );
+                if ($shMethodError !== '') {
+                    $transaction->rollBack();
+                    util::fail($shMethodError);
+                }
+            } else {
 
 
-                    //广州鑫源花卉,选择送货上门必须选必选商品
-                    if ($ghsShopId == 12439) {
-                        $hasMust = array_intersect($ids, [3446945, 3446970, 3446973, 3446979, 3446995, 3447010, 3447023, 3459983, 4333184, 4317745, 1585738]);
-                        if (empty($hasMust)) {
-                            util::fail('请返回选择 必选商品');
+                if ($sendType == 0) {
+                    if (getenv('YII_ENV') == 'production') {
+                        //杭州斗南鲜花批发部,满500,10公里内免费配送,满1000,20公里免费配送
+                        if ($ghsShopId == 4608) {
+                            if ($respond->actPrice < 500) {
+                                $transaction->rollBack();
+                                util::fail('满500元支持免费配送');
+                            }
                         }
                         }
-                    }
-                    if ($ghsShopId == 100883) {
-                        $hasMust = array_intersect($ids, [5017957,5036067,5036089,5036099,5017958,5036063,5017948,5035980,5036073,5036075,5036076,5036117,5036118,5017949,5035979,5035976,5035928,5035930,5036061,5035879]);
-                        if (empty($hasMust)) {
-                            util::fail('请返回选择 必选商品');
+                        //叶上花,满500元市区免费配送
+                        if ($ghsShopId == 4804) {
+                            if ($respond->actPrice < 500) {
+                                $transaction->rollBack();
+                                util::fail('满500元支持免费配送');
+                            }
+                        }
+                        //花悠星 国恋 勇记 万丽 陆丰暂时不支持免费配送
+                        if ($ghsShopId == 7687 || $ghsShopId == 7831 || $ghsShopId == 7778 || $ghsShopId == 12003 || $ghsShopId == 38128) {
+                            util::fail('暂不支持送货上门,请选其它配送方式!');
                         }
                         }
-                    }
-
 
 
-                    //三明易批花
-                    if ($ghsShopId == 82200) {
-                        if ($respond->actPrice < 100 || $respond->bigNum < 15) {
-                            $hasMust = array_intersect($ids, [4283478]);
+                        //广州鑫源花卉,选择送货上门必须选必选商品
+                        if ($ghsShopId == 12439) {
+                            $hasMust = array_intersect($ids, [3446945, 3446970, 3446973, 3446979, 3446995, 3447010, 3447023, 3459983, 4333184, 4317745, 1585738]);
                             if (empty($hasMust)) {
                             if (empty($hasMust)) {
-                                util::fail('没满100元且15扎,请返回选运费');
+                                util::fail('请返回选择 必选商品');
                             }
                             }
                         }
                         }
-                        // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
-                        $future = date("Y-m-d", strtotime('+2 day'));
-                        if (strtotime($respond->sendTimeWant) > strtotime($future)) {
-                            util::fail('配送日期只能选最近二天');
-                        }
-                    }
 
 
-                    if ($ghsShopId == 77703) {
-                        //天天鲜花思明店,暂时关闭送货上门
-                        if ($respond->sendType == 0) {
-                            //util::fail('节日暂停送货上门,请选到店自取');
+                        //情意花卉,必选品
+                        if ($ghsShopId == 100883) {
+                            $hasMust = array_intersect($ids, [5017957,5036067,5036089,5036099,5017958,5036063,5017948,5035980,5036073,5036075,5036076,5036117,5036118,5017949,5035979,5035976,5035928,5035930,5036061,5035879]);
+                            if (empty($hasMust)) {
+                                util::fail('请返回选择 必选商品');
+                            }
                         }
                         }
-                    }
 
 
-                    if ($ghsShopId == 86726) {
-                        //藏花林
-                        if ($respond->transType != 4 && $respond->transType != 5) {
-                            util::fail('请选同城配送或到店自取');
+                        //三明易批花
+                        if ($ghsShopId == 82200) {
+                            if ($respond->actPrice < 100 || $respond->bigNum < 15) {
+                                $hasMust = array_intersect($ids, [4283478]);
+                                if (empty($hasMust)) {
+                                    util::fail('没满100元且15扎,请返回选运费');
+                                }
+                            }
+                            // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
+                            $future = date("Y-m-d", strtotime('+2 day'));
+                            if (strtotime($respond->sendTimeWant) > strtotime($future)) {
+                                util::fail('配送日期只能选最近二天');
+                            }
                         }
                         }
-                    }
-
-                } else {
-
-                    //好运鲜花批发,选择送货上门必须选必选商品
-//                    if ($ghsShopId == 36523) {
-//                        if ($respond->transType != 4 && $respond->transType != 5) {
-//                            util::fail('请选同城配送或到店自取');
-//                        }
-//                    }
 
 
-//                    if ($ghsShopId == 36523) {
-//                        if ($respond->actPrice < 50 || $respond->bigNum < 10) {
-//                            $hasMust = array_intersect($ids, [85295]);
-//                            if (empty($hasMust)) {
-//                                util::fail('没满50元且满10扎,请运费必选商品');
-//                            }
-//                        }
-//                        // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
-//                        $future = date("Y-m-d", strtotime('+2 day'));
-//                        if (strtotime($respond->sendTimeWant) > strtotime($future)) {
-//                            util::fail('配送日期只能选最近二天');
-//                        }
-//                    }
+                        if ($ghsShopId == 77703) {
+                            //天天鲜花思明店,暂时关闭送货上门
+                            if ($respond->sendType == 0) {
+                                //util::fail('节日暂停送货上门,请选到店自取');
+                            }
+                        }
 
 
-                }
+                        if ($ghsShopId == 86726) {
+                            //藏花林
+                            if ($respond->transType != 4 && $respond->transType != 5) {
+                                util::fail('请选同城配送或到店自取');
+                            }
+                        }
 
 
-                if (isset($ghsInfo['home'])) {
-                    if ($ghsInfo['home'] == 0) {
-                        util::fail('暂不支持送货上门,请选其它配送方式');
                     }
                     }
-                    $homeAmount = $ghsInfo['homeAmount'] ? floatval($ghsInfo['homeAmount']) : 0;
-                    $homeNum = $ghsInfo['homeNum'] ? floatval($ghsInfo['homeNum']) : 0;
-                    if ($homeAmount > 0 && $homeAmount > $respond->actPrice) {
-                        util::fail("满{$homeAmount}元 可送货上门");
-                    }
-                    if ($homeNum > 0 && $homeNum > $respond->bigNum) {
-                        util::fail("满{$homeNum}扎 可送货上门");
+
+                    if (isset($ghsInfo['home'])) {
+                        if ($ghsInfo['home'] == 0) {
+                            util::fail('暂不支持送货上门,请选其它配送方式');
+                        }
+                        $homeAmount = $ghsInfo['homeAmount'] ? floatval($ghsInfo['homeAmount']) : 0;
+                        $homeNum = $ghsInfo['homeNum'] ? floatval($ghsInfo['homeNum']) : 0;
+                        if ($homeAmount > 0 && $homeAmount > $respond->actPrice) {
+                            util::fail("满{$homeAmount}元 可送货上门");
+                        }
+                        if ($homeNum > 0 && $homeNum > $respond->bigNum) {
+                            util::fail("满{$homeNum}扎 可送货上门");
+                        }
                     }
                     }
-                }
 
 
-            }
+                }
 
 
-            if ($sendType == 2) {
-                //温州易批花,跑腿,不满100,要选10元的补运费商品
-                if ($ghsShopId == 91115) {
-                    if ($respond->actPrice < 100) {
-                        $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449812, 4449811]);
-                        if (empty($hasMust)) {
-                            util::fail('不满100,必选商品 补运费10元');
+                if ($sendType == 2) {
+                    //温州易批花,跑腿,不满100,要选10元的补运费商品
+                    if ($ghsShopId == 91115) {
+                        if ($respond->actPrice < 100) {
+                            $transaction->rollBack();
+                            $hasMust = array_intersect($ids, [4449812, 4449811]);
+                            if (empty($hasMust)) {
+                                util::fail('不满100,必选商品 补运费10元');
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
-            }
-            if ($sendType == 4) {
-                //温州易批花,快递,不满100,要选10元的补运费商品
-                if ($ghsShopId == 91115) {
-                    if ($respond->actPrice < 100) {
-                        $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449812, 4449811]);
-                        if (empty($hasMust)) {
-                            util::fail('不满100,必选商品 补运费10元');
+                if ($sendType == 4) {
+                    //温州易批花,快递,不满100,要选10元的补运费商品
+                    if ($ghsShopId == 91115) {
+                        if ($respond->actPrice < 100) {
+                            $transaction->rollBack();
+                            $hasMust = array_intersect($ids, [4449812, 4449811]);
+                            if (empty($hasMust)) {
+                                util::fail('不满100,必选商品 补运费10元');
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
-            }
-            if ($sendType == 3) {
-                //温州易批花,物流,不满200,要选10元的补运费商品
-                if ($ghsShopId == 91115) {
-                    if ($respond->actPrice < 200) {
-                        $transaction->rollBack();
-                        $hasMust = array_intersect($ids, [4449812, 4449811]);
-                        if (empty($hasMust)) {
-                            util::fail('不满200,必选商品 补运费10元');
+                if ($sendType == 3) {
+                    //温州易批花,物流,不满200,要选10元的补运费商品
+                    if ($ghsShopId == 91115) {
+                        if ($respond->actPrice < 200) {
+                            $transaction->rollBack();
+                            $hasMust = array_intersect($ids, [4449812, 4449811]);
+                            if (empty($hasMust)) {
+                                util::fail('不满200,必选商品 补运费10元');
+                            }
                         }
                         }
                     }
                     }
                 }
                 }
+
             }
             }
 
 
             $transaction->commit();
             $transaction->commit();
@@ -929,11 +963,15 @@ class PurchaseController extends BaseController
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                 }
                 }
             } else {
             } else {
-                if (isset($info->sendType) && $info->sendType == 4) {
-                    //标记当天已收一次包装费,岭南批发市场用的功能
-                    $current = date("Y_m_d");
-                    $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+                //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
+                $current = date("Y_m_d");
+                if (isset($info->sendType) && in_array($info->sendType, [0, 4])) {
+                    $key = 'ghs_custom_today_has_get_pack_cost_' . $info->sendType . '_' . $current . '_' . $customId;
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
                     Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
+
+                    // 兼容快递收运费的情况
+                    $sendKey = 'ghs_custom_today_has_get_send_cost_' . $info->sendType . '_' . $current . '_' . $customId;
+                    Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
                 }
                 }
             }
             }
 
 

+ 6 - 3
app-hd/controllers/ShMethodController.php

@@ -48,11 +48,14 @@ class ShMethodController extends BaseController
             }
             }
 
 
             if ($customId > 0) {
             if ($customId > 0) {
-                $hasPaidSendCost = ShMethodClass::isSendCostPaidToday($customId);
-                $hasPaidPackCost = ShMethodClass::isPaidToday($customId);
-                
                 foreach ($configs as &$config) {
                 foreach ($configs as &$config) {
+                    $style = (int)($config['style'] ?? 0);
                     $unMeet = (int)($config['unMeet'] ?? 0);
                     $unMeet = (int)($config['unMeet'] ?? 0);
+
+                    // 针对每个配送方式分别检查是否已支付运费或包装费
+                    $hasPaidSendCost = ShMethodClass::isSendCostPaidToday($customId, $style);
+                    $hasPaidPackCost = ShMethodClass::isPackPaidToday($customId, $style);
+
                     // 如果是加收运费或加收包装费,并且今天已经收过对应的费用
                     // 如果是加收运费或加收包装费,并且今天已经收过对应的费用
                     // 则将前端展示的条件清空(设为0),从而不再显示要收附加费的提示
                     // 则将前端展示的条件清空(设为0),从而不再显示要收附加费的提示
                     if ($unMeet === 0 && $hasPaidSendCost) {
                     if ($unMeet === 0 && $hasPaidSendCost) {

+ 9 - 1
biz-ghs/order/classes/OrderItemClass.php

@@ -7,6 +7,7 @@ use bizGhs\book\classes\BookItemClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\ghs\classes\GhsClass;
 use bizGhs\ghs\classes\GhsClass;
 use bizGhs\product\classes\ProductClass;
 use bizGhs\product\classes\ProductClass;
+use bizGhs\shop\classes\ShopClass;
 use bizGhs\stock\classes\StockRecordClass;
 use bizGhs\stock\classes\StockRecordClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseClass;
 use bizHd\purchase\classes\PurchaseItemClass;
 use bizHd\purchase\classes\PurchaseItemClass;
@@ -335,6 +336,13 @@ class OrderItemClass extends BaseClass
 
 
         $level = $custom->level ?? 0;
         $level = $custom->level ?? 0;
         $live = isset($custom->live) ? $custom->live : 1;
         $live = isset($custom->live) ? $custom->live : 1;
+        $shopId = $post['shopId'] ?? 0;
+        $skipLimitBuy = false;
+        if (!empty($shopId)) {
+            $shop = ShopClass::getById($shopId, true, 'id, skCustomId');
+            $skipLimitBuy = !empty($shop->skCustomId) && intval($shop->skCustomId) == $customId;
+        }
+        $moreParams['skipLimitBuy'] = $skipLimitBuy;
         $respond = ProductClass::formatProductInfo($products, $level, $live, $moreParams);
         $respond = ProductClass::formatProductInfo($products, $level, $live, $moreParams);
         $products = $respond['product'];
         $products = $respond['product'];
         $weight = 0;
         $weight = 0;
@@ -450,7 +458,7 @@ class OrderItemClass extends BaseClass
             $weight = bcadd($w, $weight, 2);
             $weight = bcadd($w, $weight, 2);
 
 
             $limitBuy = $p['limitBuy'];
             $limitBuy = $p['limitBuy'];
-            if ($limitBuy > 0) {
+            if ($limitBuy > 0 && $skipLimitBuy == false) {
                 ProductClass::handleLimitBuy($p, $customId, floatval($itemNum));
                 ProductClass::handleLimitBuy($p, $customId, floatval($itemNum));
             }
             }
 
 

+ 11 - 9
biz-ghs/order/classes/ShMethodClass.php

@@ -270,10 +270,10 @@ class ShMethodClass extends BaseClass
             $feeToCheck = $unMeet === 2 ? $packCost : $sendCost;
             $feeToCheck = $unMeet === 2 ? $packCost : $sendCost;
             
             
             // 如果今天已经收过对应的附加费用,则直接通过校验
             // 如果今天已经收过对应的附加费用,则直接通过校验
-            if ($unMeet === 2 && self::isPaidToday($customId)) {
+            if ($unMeet === 2 && self::isPackPaidToday($customId, $style)) {
                 return '';
                 return '';
             }
             }
-            if ($unMeet === 0 && self::isSendCostPaidToday($customId)) {
+            if ($unMeet === 0 && self::isSendCostPaidToday($customId, $style)) {
                 return '';
                 return '';
             }
             }
             
             
@@ -287,18 +287,19 @@ class ShMethodClass extends BaseClass
     }
     }
 
 
     /**
     /**
-     * 判断当天是否已经收过附加费(运费或包装费)
+     * 判断当天是否已经收过附加费(包装费)
      * 与其他逻辑共用同一个 Redis Key,保证一天只收一次
      * 与其他逻辑共用同一个 Redis Key,保证一天只收一次
      * @param int $customId 客户ID
      * @param int $customId 客户ID
+     * @param int $sendType 配送方式 (0: 送货, 4: 快递)
      * @return bool
      * @return bool
      */
      */
-    public static function isPaidToday($customId)
+    public static function isPackPaidToday($customId, $sendType = 0)
     {
     {
         if (empty($customId)) {
         if (empty($customId)) {
             return false;
             return false;
         }
         }
         $current = date("Y_m_d");
         $current = date("Y_m_d");
-        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+        $key = 'ghs_custom_today_has_get_pack_cost_' . $sendType . '_' . $current . '_' . $customId;
         $has = \Yii::$app->redis->executeCommand('GET', [$key]);
         $has = \Yii::$app->redis->executeCommand('GET', [$key]);
         return (!empty($has) && $has == 1);
         return (!empty($has) && $has == 1);
     }
     }
@@ -306,15 +307,16 @@ class ShMethodClass extends BaseClass
     /**
     /**
      * 判断当天是否已经收过运费
      * 判断当天是否已经收过运费
      * @param int $customId 客户ID
      * @param int $customId 客户ID
+     * @param int $sendType 配送方式
      * @return bool
      * @return bool
      */
      */
-    public static function isSendCostPaidToday($customId)
+    public static function isSendCostPaidToday($customId, $sendType = 0)
     {
     {
         if (empty($customId)) {
         if (empty($customId)) {
             return false;
             return false;
         }
         }
         $current = date("Y_m_d");
         $current = date("Y_m_d");
-        $key = 'ghs_custom_today_has_get_send_cost_' . $current . '_' . $customId;
+        $key = 'ghs_custom_today_has_get_send_cost_' . $sendType . '_' . $current . '_' . $customId;
         $has = \Yii::$app->redis->executeCommand('GET', [$key]);
         $has = \Yii::$app->redis->executeCommand('GET', [$key]);
         return (!empty($has) && $has == 1);
         return (!empty($has) && $has == 1);
     }
     }
@@ -380,11 +382,11 @@ class ShMethodClass extends BaseClass
         if ($unMeetFee > 0) {
         if ($unMeetFee > 0) {
             // unMeet: 0 加收运费(默认),2 加收包装费
             // unMeet: 0 加收运费(默认),2 加收包装费
             if ($unMeet === 0) {
             if ($unMeet === 0) {
-                if (!self::isSendCostPaidToday($customId)) {
+                if (!self::isSendCostPaidToday($customId, $style)) {
                     $costs['sendCost'] = $unMeetFee;
                     $costs['sendCost'] = $unMeetFee;
                 }
                 }
             } elseif ($unMeet === 2) {
             } elseif ($unMeet === 2) {
-                if (!self::isPaidToday($customId)) {
+                if (!self::isPackPaidToday($customId, $style)) {
                     $costs['packCost'] = $unMeetFee;
                     $costs['packCost'] = $unMeetFee;
                 }
                 }
             }
             }

+ 10 - 4
biz-ghs/product/classes/ProductClass.php

@@ -366,6 +366,7 @@ class ProductClass extends BaseClass
             $list[$k]['smallNum'] = $stockInfo['smallNum'];
             $list[$k]['smallNum'] = $stockInfo['smallNum'];
 
 
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
             $price = self::getFinalPrice($v, $level, $priceMap, $addPriceMap);
+            $list[$k]['originPrice'] = $list[$k]['price']; //原始价
             $list[$k]['price'] = $price;
             $list[$k]['price'] = $price;
             $list[$k]['bigPrice'] = $price;
             $list[$k]['bigPrice'] = $price;
             $smallRatio = $v['smallRatio'] ?? 0;
             $smallRatio = $v['smallRatio'] ?? 0;
@@ -1465,6 +1466,7 @@ class ProductClass extends BaseClass
         $book = $moreParams['book'] ?? 0;
         $book = $moreParams['book'] ?? 0;
         $customShopAdminId = $moreParams['customShopAdminId'] ?? 0;
         $customShopAdminId = $moreParams['customShopAdminId'] ?? 0;
         $custom = $moreParams['custom'] ?? [];
         $custom = $moreParams['custom'] ?? [];
+        $skipLimitBuy = $moreParams['skipLimitBuy'] ?? false;
         //不同等级对应 price addPrice
         //不同等级对应 price addPrice
         $priceMap = CustomClass::$levelPriceKeyMap;
         $priceMap = CustomClass::$levelPriceKeyMap;
         //这个参数应该是要作废的,但下面加的参数是有用的,多处要同步修改,关键词 abandon_add_price_map ,ssh 20260116
         //这个参数应该是要作废的,但下面加的参数是有用的,多处要同步修改,关键词 abandon_add_price_map ,ssh 20260116
@@ -1503,12 +1505,16 @@ class ProductClass extends BaseClass
                 if ($book == 1 && $customShopAdminId > 0) {
                 if ($book == 1 && $customShopAdminId > 0) {
                     $itemPrice = 0.1;
                     $itemPrice = 0.1;
                 } else {
                 } else {
-                    $limitKey = self::LIMIT_BUY_KEY . $ghsProductId;
-                    $hasBuyNum = Yii::$app->redis->executeCommand('HGET', [$limitKey, $custom['id']]);
-                    $hasBuyNum = $itemNum + ($hasBuyNum == null ? 0 : $hasBuyNum); // 已购买总数量
+                    $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); // 已购买总数量
+                    }
 
 
                     //今日特价、会员价
                     //今日特价、会员价
-                    $itemPrice = self::getFinalPrice($currentGhsProduct, $level, $priceMap, $addPriceMap, $changePrice, $itemNum, $hasBuyNum);
+                    $itemPrice = self::getFinalPrice($currentGhsProduct, $level, $priceMap, $addPriceMap, $changePrice, $priceBuyNum, $totalBuyNum);
                 }
                 }
                 $thisPrice = $itemPrice;
                 $thisPrice = $itemPrice;
 
 

+ 3 - 5
biz-hd/shop/classes/ShopClass.php

@@ -46,11 +46,11 @@ class ShopClass extends BaseClass
     }
     }
 
 
     //需要算上包装费
     //需要算上包装费
-    public static function needAddPackCost($ghsShop, $customId, $orderAmount = 0)
+    public static function needAddPackCost($ghsShop, $customId, $sendType = 0, $orderAmount = 0)
     {
     {
+        $current = date("Y_m_d");
+        $key = 'ghs_custom_today_has_get_pack_cost_' . $sendType . '_' . $current . '_' . $customId;
         if (isset($ghsShop->pfLevel) && $ghsShop->pfLevel == 1) {
         if (isset($ghsShop->pfLevel) && $ghsShop->pfLevel == 1) {
-            $current = date("Y_m_d");
-            $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
             $has = Yii::$app->redis->executeCommand('GET', [$key]);
             $has = Yii::$app->redis->executeCommand('GET', [$key]);
             if (!empty($has) && $has == 1) {
             if (!empty($has) && $has == 1) {
                 return false;
                 return false;
@@ -63,8 +63,6 @@ class ShopClass extends BaseClass
             if ($lackExpend <= 0 || $packCost <= 0) {
             if ($lackExpend <= 0 || $packCost <= 0) {
                 return false;
                 return false;
             }
             }
-            $current = date("Y_m_d");
-            $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
             $has = Yii::$app->redis->executeCommand('GET', [$key]);
             $has = Yii::$app->redis->executeCommand('GET', [$key]);
             if (!empty($has) && $has == 1) {
             if (!empty($has) && $has == 1) {
                 return false;
                 return false;

+ 1 - 1
common/components/delivery/services/DispatchService.php

@@ -421,7 +421,7 @@ class DispatchService
         // 构建所需车型数据
         // 构建所需车型数据
         $vehicleTypeList = [];
         $vehicleTypeList = [];
         foreach ($vehicleList as $vehicle) {
         foreach ($vehicleList as $vehicle) {
-            if(!in_array($vehicle['vehicle_name'], ['跑腿', '小面', '微面'])){ // && !$this->adapters['huolala']->getIsSandbox()
+            if(!in_array($vehicle['vehicle_name'], ['跑腿', '四轮小件', '小面', '微面'])){ // && !$this->adapters['huolala']->getIsSandbox()
                 continue;
                 continue;
             }
             }
 
 

+ 10 - 0
common/components/dict.php

@@ -688,4 +688,14 @@ class dict
         return $respond;
         return $respond;
     }
     }
 
 
+    public static function getNewMethodShop()
+    {
+        $newShop = !getenv('NEW_METHOD_SHOP') ? '' : getenv('NEW_METHOD_SHOP');
+        if (empty($newShop)) {
+            return [];
+        }
+        $newShop = trim($newShop);
+        return explode(',', $newShop);
+    }
+
 }
 }