From e159204a2f531780a42ab522bd6a9328c1d02ead Mon Sep 17 00:00:00 2001 From: devil Date: Thu, 30 Jan 2020 12:11:40 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=9C=B0=E5=9D=80=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/BuyService.php | 15 +++++++++++++++ application/service/UserService.php | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) 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']);