shish před 10 měsíci
rodič
revize
830c1e82cb

+ 2 - 2
app-hd/controllers/PurchaseController.php

@@ -1274,8 +1274,8 @@ class PurchaseController extends BaseController
         $get = Yii::$app->request->get();
 
         $shop = $this->shop;
-        $shopLat = isset($shop->lat) ? $shop->lat : '';
-        $shopLong = isset($shop->long) ? $shop->long : '';
+        $shopLat = $shop->lat ?? '';
+        $shopLong = $shop->long ?? '';
 
         if (empty($shopLat) || empty($shopLong)) {
             util::success(['distance' => 0, 'showDistance' => 0, 'fee' => 0]);

+ 11 - 10
biz-hd/purchase/classes/PurchaseClass.php

@@ -376,19 +376,23 @@ class PurchaseClass extends BaseClass
     }
 
     //计算距离和运费【另外还有个地方要同步修改,关键词calc_freight_distance】 ssh 20221003
-    public static function getDistanceFee($shop, $ghsShop, $weight)
+    public static function getDistanceFee($shop, $ghsShop, $weight, $mustHasFee = false)
     {
-        return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
 
-        $shopLat = isset($shop->lat) ? $shop->lat : '';
-        $shopLong = isset($shop->long) ? $shop->long : '';
+        //万丽花行 跑腿不算运费
+        if ($ghsShop->id == 12003) {
+            return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
+        }
+
+        $shopLat = $shop->lat ?? '';
+        $shopLong = $shop->long ?? '';
 
         if (empty($shopLat) || empty($shopLong)) {
             util::fail('请完善门店地址哦');
         }
 
-        $ghsShopLat = isset($ghsShop->lat) ? $ghsShop->lat : '';
-        $ghsShopLong = isset($ghsShop->long) ? $ghsShop->long : '';
+        $ghsShopLat = $ghsShop->lat ?? '';
+        $ghsShopLong = $ghsShop->long ?? '';
         if (empty($ghsShopLat) || empty($ghsShopLong)) {
             util::fail('商家地址有问题');
         }
@@ -452,10 +456,7 @@ class PurchaseClass extends BaseClass
 
         //noticeUtil::push("距离:{$distance} {$showDistance} 重量:{$weight} 费用:{$totalFee}", '15280215347');
 
-        //万丽花行 跑腿不算运费
-        if ($ghsShop->id == 12003) {
-            return ['distance' => 0, 'showDistance' => 0, 'fee' => 0];
-        }
+
         return ['distance' => $distance, 'showDistance' => $showDistance, 'fee' => $totalFee];
     }