mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 10:59:47 +08:00
地址优化
This commit is contained in:
parent
ddadd3dc49
commit
e159204a2f
@ -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,
|
||||
|
@ -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']);
|
||||
|
Loading…
Reference in New Issue
Block a user