Explorar el Código

昆明批发,不需要算打包费和运费

shish hace 2 años
padre
commit
ba3144ca16
Se han modificado 2 ficheros con 31 adiciones y 15 borrados
  1. 5 0
      app-hd/controllers/GhsController.php
  2. 26 15
      biz-hd/shop/classes/ShopClass.php

+ 5 - 0
app-hd/controllers/GhsController.php

@@ -163,9 +163,14 @@ class GhsController extends BaseController
         $lackExpend = $ghsShop->lackExpend ? floatval($ghsShop->lackExpend) : 0;
         $customId = $info['customId'] ?? 0;
         $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShop, $customId);
+        //昆明批发,需要算打包费和运费
+        $needAddPackFreight = 1;
         if ($needAdd == false) {
             $lackExpend = 0;
+            //昆明批发,不需要算打包费和运费
+            $needAddPackFreight = 0;
         }
+        $info['needAddPackFreight'] = $needAddPackFreight;
         $info['lackExpend'] = $lackExpend;
         $info['showSold'] = $ghsShop->showSold ?? 0;
         $info['buyNotice'] = $ghsShop->buyNotice ?? 0;

+ 26 - 15
biz-hd/shop/classes/ShopClass.php

@@ -24,25 +24,36 @@ class ShopClass extends BaseClass
     //需要算上包装费
     public static function needAddPackCost($ghsShop, $customId, $orderAmount = 0)
     {
-        $lackExpend = $ghsShop->lackExpend ? floatval($ghsShop->lackExpend) : 0;
-        $packCost = $ghsShop->packCost ? floatval($ghsShop->packCost) : 0;
-        if ($lackExpend <= 0 || $packCost <= 0) {
-            return false;
-        }
-        $current = date("Y_m_d");
-        $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
-        $has = Yii::$app->redis->executeCommand('GET', [$key]);
-        if (!empty($has) && $has == 1) {
-            return false;
-        }
-        if ($orderAmount > 0) {
-            if ($orderAmount < $lackExpend) {
+        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]);
+            if (!empty($has) && $has == 1) {
+                return false;
+            } else {
                 return true;
             }
         } else {
-            return true;
+            $lackExpend = $ghsShop->lackExpend ? floatval($ghsShop->lackExpend) : 0;
+            $packCost = $ghsShop->packCost ? floatval($ghsShop->packCost) : 0;
+            if ($lackExpend <= 0 || $packCost <= 0) {
+                return false;
+            }
+            $current = date("Y_m_d");
+            $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
+            $has = Yii::$app->redis->executeCommand('GET', [$key]);
+            if (!empty($has) && $has == 1) {
+                return false;
+            }
+            if ($orderAmount > 0) {
+                if ($orderAmount < $lackExpend) {
+                    return true;
+                }
+            } else {
+                return true;
+            }
+            return false;
         }
-        return false;
     }
 
     public static function getNewShopList()