本地生活添加入驻信息增加经纬度转换

This commit is contained in:
wangxiaowei 2024-10-18 10:28:07 +08:00
parent 136f91cc8c
commit 64c180e53f

@ -77,14 +77,13 @@ class LocalStore extends Api
// 调用腾讯地图将本地生活地理位置转换为经纬度
try {
$url = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . ConfigServer::get('map', 'tx_map_key') . '&address=' . str_replace(' ', '', $data['address']);
$result = file_get_contents($url);
$location = json_decode($result, true);
dump($location);die;
dump($location);die;
} catch (\Exception $e) {
dump('error: ' . $e->getMessage());die;
}
die;
$content = file_get_contents($url);
$location = json_decode($content, true);
if ($location['message'] === 'Success') {
$data['latitude'] = $location['result']['location']['lat'];
$data['longitude'] = $location['result']['location']['lng'];
}
} catch (\Exception $e) {}
if (isset($data['lstore_id']) && $data['lstore_id'] != 0) {
$data['store_state'] = 0;