shish 6 hónapja
szülő
commit
703c88750c
2 módosított fájl, 12 hozzáadás és 76 törlés
  1. 9 73
      app-hd/controllers/PurchaseController.php
  2. 3 3
      biz/ghs/classes/GhsClass.php

+ 9 - 73
app-hd/controllers/PurchaseController.php

@@ -330,7 +330,7 @@ class PurchaseController extends BaseController
                 $presellData = [];
                 $nowTime = strtotime(date("Y-m-d"));
                 foreach ($productInfoList as $currentInfo) {
-                    if (isset($currentInfo['mainId']) == false || $currentInfo['mainId'] != $ghsMainId) {
+                    if (!isset($currentInfo['mainId']) || $currentInfo['mainId'] != $ghsMainId) {
                         util::fail('只能选择同一家的商品哦');
                     }
                     $currentName = $currentInfo['name'] ?? '';
@@ -427,46 +427,6 @@ class PurchaseController extends BaseController
             $ghsInfo['kiloFee'] = $ghsShopInfo->kiloFee ?? 0;
             $ghsInfo['miniKilo'] = $ghsShopInfo->miniKilo ?? 0;
 
-            //旭海银柳的临时解决办法
-            if (getenv('YII_ENV') == 'production') {
-                if ($ghsShopInfo->mainId == 41121) {
-                    $mer = [1903693, 1903712, 1903789, 1903796, 1903816, 1903841, 1903855, 1903859, 1903860, 1903864];
-                    $getIds = array_column($productList, 'productId');
-                    $hasYl = false;
-                    foreach ($productList as $ylVal) {
-                        $ylProductId = $ylVal['productId'];
-                        if (in_array($ylProductId, $mer)) {
-                            $hasYl = true;
-                        }
-                    }
-                    if ($hasYl) {
-                        $myInfoList = ProductClass::getAllByCondition(['id' => ['in', $getIds]], null, '*', 'id');
-                        $currentMap = [1903693 => 220, 1903712 => 150, 1903789 => 100, 1903796 => 60, 1903816 => 45, 1903841 => 80, 1903855 => 55, 1903859 => 40, 1903860 => 25, 1903864 => 20];
-                        foreach ($productList as $ylKey => $ylValue) {
-                            $ylProductId = $ylValue['productId'];
-                            $num = $ylValue['bigNum'] ?? 0;
-                            if (!isset($currentMap[$ylProductId])) {
-                                util::fail('花材有问题');
-                            }
-                            $mustBeNum = $currentMap[$ylProductId];
-                            $myInfo = $myInfoList[$ylProductId] ?? [];
-                            if (empty($myInfo)) {
-                                util::fail('花材有问题哦');
-                            }
-                            $myName = $myInfo['name'] ?? '';
-                            if ($num >= $mustBeNum) {
-                                $curVal = $num / $mustBeNum;
-                                if ($curVal != intval($curVal)) {
-                                    util::fail($myName . ' 要' . $mustBeNum . '捆或' . $mustBeNum . '的倍数');
-                                }
-                            } else {
-                                util::fail($myName . ' 数量要' . $mustBeNum . '捆');
-                            }
-                        }
-                    }
-                }
-            }
-
             $post['product'] = $productList;
 
             $sendType = $post['sendType'] ?? 0;
@@ -518,7 +478,7 @@ class PurchaseController extends BaseController
                 }
                 //如果已经算过一次打包费和运费了,则不再费了
                 $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
-                if ($needAdd == false) {
+                if (!$needAdd) {
                     $packCost = 0;
                     if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
                         noticeUtil::push("没有计算打包费原因:已经算过一次了", '15280215347');
@@ -692,41 +652,17 @@ class PurchaseController extends BaseController
                     if ($ghsInfo['home'] == 0) {
                         util::fail('暂不支持送货上门,请选其它配送方式');
                     }
-                    if (!empty($ghsInfo['homeAmount'])) {
-                        $homeType = $ghsInfo['homeType'] ?? 0;
-                        $homeAmount = floatval($ghsInfo['homeAmount']);
-                        if ($homeType == 0) {
-                            if ($homeAmount > $respond->actPrice) {
-                                util::fail("满{$homeAmount}元 可送货上门");
-                            }
-                        }
-                        if ($homeType == 1) {
-                            if ($homeAmount > $respond->bigNum) {
-                                util::fail("满{$homeAmount}扎 可送货上门");
-                            }
-                        }
-                    }
-                }
-
-            }
-
-            if (getenv('YII_ENV') == 'production') {
-                //昆明花落谁家
-                if ($ghsShopId == 13398) {
-                    if ($respond->bigNum < 15) {
-                        $transaction->rollBack();
-                        util::fail('不足15扎,请联系店长');
+                    $homeAmount = $ghsInfo['homeAmount'] ? floatval($ghsInfo['homeAmount']) : 0;
+                    $homeNum = $ghsInfo['homeNum'] ? floatval($ghsInfo['homeNum']) : 0;
+                    if ($homeAmount > 0 && $homeAmount > $respond->actPrice) {
+                        util::fail("满{$homeAmount}元 可送货上门");
                     }
-                }
-                //盛丰最少要20扎
-                if ($ghsShopId == 44556) {
-                    if ($respond->bigNum < 20) {
-                        $transaction->rollBack();
-                        util::fail('最少要20扎');
+                    if ($homeNum > 0 && $homeNum > $respond->bigNum) {
+                        util::fail("满{$homeAmount}扎 可送货上门");
                     }
                 }
-            }
 
+            }
             $transaction->commit();
 
             util::success($respond);

+ 3 - 3
biz/ghs/classes/GhsClass.php

@@ -52,7 +52,7 @@ class GhsClass extends BaseClass
         $needCheck = $ghsShop['needCheck'] ?? 0;
         $home = $ghsShop['home'] ?? 0;
         $homeAmount = $ghsShop['homeAmount'] ?? 0;
-        $homeType = $ghsShop['homeType'] ?? 0;
+        $homeNum = $ghsShop['homeNum'] ?? 0;
         $passStatus = $needCheck == 1 ? 0 : 1;
         $live = $ghsShop['live'] ?? 1;
         $isHd = $ghsShop['isHd'] ?? 1;
@@ -104,7 +104,7 @@ class GhsClass extends BaseClass
                 'passStatus' => $passStatus,
                 'home' => $home,
                 'homeAmount' => $homeAmount,
-                'homeType' => $homeType,
+                'homeNum' => $homeNum,
             ];
             $ghs = self::addGhs($data);
         }
@@ -162,7 +162,7 @@ class GhsClass extends BaseClass
                 'passStatus' => $passStatus,
                 'home' => $home,
                 'homeAmount' => $homeAmount,
-                'homeType' => $homeType,
+                'homeNum' => $homeNum,
             ];
             $custom = CustomClass::addCustom($customData);
         }