diff --git a/application/service/BuyService.php b/application/service/BuyService.php index 7d7e42374..e5b933637 100755 --- a/application/service/BuyService.php +++ b/application/service/BuyService.php @@ -1217,6 +1217,21 @@ class BuyService */ private static function OrderAddressInsert($order_id, $user_id, $address) { + // 坐标处理 + if(in_array(APPLICATION_CLIENT_TYPE, config('shopxo.coordinate_transformation'))) + { + // 坐标转换 火星(高德,谷歌,腾讯坐标) 转 百度 + if(isset($address['lng']) && isset($address['lat']) && $address['lng'] > 0 && $address['lat'] > 0) + { + $map = \base\GeoTransUtil::GcjToBd($address['lng'], $address['lat']); + if(isset($map['lng']) && isset($map['lat'])) + { + $address['lng'] = $map['lng']; + $address['lat'] = $map['lat']; + } + } + } + // 订单收货地址 $data = [ 'order_id' => $order_id, diff --git a/application/service/UserService.php b/application/service/UserService.php index f0af8dcaf..a5d91e1b2 100755 --- a/application/service/UserService.php +++ b/application/service/UserService.php @@ -454,6 +454,22 @@ class UserService $is_default = false; foreach($data as &$v) { + // 坐标处理 + if(in_array(APPLICATION_CLIENT_TYPE, config('shopxo.coordinate_transformation'))) + { + // 坐标转换 百度转火星(高德,谷歌,腾讯坐标) + if(isset($v['lng']) && isset($v['lat']) && $v['lng'] > 0 && $v['lat'] > 0) + { + $map = \base\GeoTransUtil::BdToGcj($v['lng'], $v['lat']); + if(isset($map['lng']) && isset($map['lat'])) + { + $v['lng'] = $map['lng']; + $v['lat'] = $map['lat']; + } + } + } + + // 地区 $v['province_name'] = RegionService::RegionName($v['province']); $v['city_name'] = RegionService::RegionName($v['city']); $v['county_name'] = RegionService::RegionName($v['county']);