shish 3 лет назад
Родитель
Сommit
c9d5668af4

+ 0 - 69
app-hd/controllers/TestController.php

@@ -8,74 +8,5 @@ use Yii;
 
 class TestController extends BaseController
 {
-    public $guestAccess = ['show'];
-
-    public function actionShow()
-    {
-
-        //基础配送费8元,0-5公里,每公里+1元,5-100公里,6元起,每公里+2元
-        //5-10公斤,2元起,每公斤+2元,10-15公斤,+12元,超过15公斤,+20元
-        //00:00 - 06:00 +6元,22:00-24:00 +4元
-        //恶劣天气,下单高峰期会临时调整价格
-
-        //起步价
-        $baseFee = 8;
-
-        $distance = 3300;
-        $weight = 15.1;
-
-        echo "距离 {$distance} 重量:{$weight} <br/>\n";
-
-        //0-5公里,每公里+1元,5-100公里,6元起,每公里+2元
-        $formatDistance = ceil($distance / 1000);
-        $startKiloFee = 6;
-        if ($formatDistance < 5) {
-            $addDistanceFee = bcmul($formatDistance, 1);
-        } elseif ($formatDistance == 5) {
-            $addDistanceFee = $startKiloFee;
-        } else {
-            $overKilo = bcsub($formatDistance, 5);
-            $overFee = bcmul($overKilo, 2);
-            $addDistanceFee = bcadd($startKiloFee, $overFee);
-        }
-
-        //5-10公斤,2元起,每公斤+2元,10-15公斤,+12元,超过15公斤,+20元
-        $formatWeight = ceil($weight);
-        if ($formatWeight > 15) {
-            $addWeightFee = 20;
-        } elseif ($formatWeight >= 10 && $formatWeight <= 15) {
-            $addWeightFee = 12;
-        } elseif ($formatWeight >= 5 && $formatWeight < 10) {
-            $overWeight = bcsub($formatWeight, 4);
-            $addWeightFee = bcmul($overWeight, 2);
-        } else {
-            $addWeightFee = 0;
-        }
-
-        $addFee = bcadd($addDistanceFee, $addWeightFee, 2);
-        $totalFee = bcadd($baseFee, $addFee, 2);
-
-        //特殊时段费
-        $timeFee = 0;
-        $hour = date("G");
-        //22:00 - 24:00 +4元
-        if (in_array($hour, [22, 23])) {
-            $timeFee = 4;
-        }
-        //00:00 - 06:00 +6元
-        if (in_array($hour, [0, 1, 2, 3, 4, 5])) {
-            $timeFee = 6;
-        }
-        $totalFee = bcadd($totalFee, $timeFee, 2);
-
-        //恶劣天气和下单高峰费用
-        $weatherFee = 0;
-        $totalFee = bcadd($totalFee, $weatherFee, 2);
-
-        $showDistance = sprintf("%.1f", ($distance / 1000));
-
-        echo "<pre>";
-        print_r(['distance' => $distance, 'showDistance' => $showDistance, 'fee' => $totalFee]);
-    }
 
 }

+ 1 - 1
biz-hd/purchase/classes/PurchaseClass.php

@@ -82,7 +82,7 @@ class PurchaseClass extends BaseClass
         //恶劣天气,下单高峰期会临时调整价格
 
         //起步价
-        $baseFee = 8;
+        $baseFee = 9;
         $distance = mapUtil::calculateDistance($shopLong, $shopLat, $ghsShopLong, $ghsShopLat);
 
         //0-5公里,每公里+1元,5-100公里,6元起,每公里+2元

+ 2 - 2
biz-mall/order/classes/OrderClass.php

@@ -67,14 +67,14 @@ class OrderClass extends BaseClass
         //恶劣天气,下单高峰期会临时调整价格
 
         //起步价
-        $baseFee = 8;
+        $baseFee = 9;
         $distance = mapUtil::calculateDistance($userLong, $userLat, $shopLong, $shopLat);
 
         //0-5公里,每公里+1元,5-100公里,6元起,每公里+2元
         $formatDistance = ceil($distance / 1000);
         $startKiloFee = 6;
         if ($formatDistance < 5) {
-            $addDistanceFee = bcmul($formatDistance, 1);
+            $addDistanceFee = bcmul($formatDistance, 2);
         } elseif ($formatDistance == 5) {
             $addDistanceFee = $startKiloFee;
         } else {

+ 2 - 1
common/components/freight.php

@@ -42,7 +42,8 @@ class freight
             return "";
             // util::fail("距离太远了哦!");
         }
-        $cost = 8; //起步价
+        //起步
+        $cost = 9;
         //距离计算
         Yii::info("距离为:".$phpStatDistance);