Przeglądaj źródła

Merge branch 'master' into dev

shish 8 godzin temu
rodzic
commit
efc6592f7d
1 zmienionych plików z 12 dodań i 4 usunięć
  1. 12 4
      common/components/mapUtil.php

+ 12 - 4
common/components/mapUtil.php

@@ -27,13 +27,18 @@ class mapUtil
         return Json::decode($result);
     }
 
-    //计算距离 lng经度 lat纬度 ssh 2020.5.14
+    /**
+     * 计算两点骑行距离(米)。
+     * 使用高德普通骑行路径规划 /v5/direction/bicycling(配额更宽);
+     * 不再用 electrobike 电动车接口(高级服务,日调用量通常很低)。
+     * 与电动车路线相比,城市场景一般差几十到一两百米,少数因限行差异可能更大,运费场景可接受。
+     */
     public static function calculateDistance($fromLnt, $fromLat, $toLnt, $toLat)
     {
         if (getenv('YII_ENV') == 'production') {
-            $url = "https://restapi.amap.com/v5/direction/electrobike?key=" . self::$thirdMapKey . '&origin=' . $fromLnt . ',' . $fromLat . '&destination=' . $toLnt . ',' . $toLat;
+            $url = "https://restapi.amap.com/v5/direction/bicycling?key=" . self::$thirdMapKey . '&origin=' . $fromLnt . ',' . $fromLat . '&destination=' . $toLnt . ',' . $toLat;
         } else {
-            $url = "http://restapi.amap.com/v5/direction/electrobike?key=" . self::$thirdMapKey . '&origin=' . $fromLnt . ',' . $fromLat . '&destination=' . $toLnt . ',' . $toLat;
+            $url = "http://restapi.amap.com/v5/direction/bicycling?key=" . self::$thirdMapKey . '&origin=' . $fromLnt . ',' . $fromLat . '&destination=' . $toLnt . ',' . $toLat;
         }
         $curl = new curl\Curl();
         $result = $curl->get($url);
@@ -53,7 +58,10 @@ class mapUtil
         return $distance;
     }
 
-    //计算客户到店距离,骑电动车 ssh 2026.7.30
+    /**
+     * 计算客户到店骑行距离(内部仍走 calculateDistance=普通骑行)。
+     * 方法名保留 EleBike 兼容已有调用方,实际已非电动车接口。
+     */
     public static function calcShopDistanceByEleBike($beginPlace, $toPlace, $report = 1)
     {
         $beginLnt = $beginPlace->long ?? '';