From 64c180e53f35cec3a32d8bc29f58bb712deef034 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Fri, 18 Oct 2024 10:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E7=94=9F=E6=B4=BB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=A9=BB=E4=BF=A1=E6=81=AF=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BB=8F=E7=BA=AC=E5=BA=A6=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LocalStore.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/api/controller/LocalStore.php b/app/api/controller/LocalStore.php index d899103b..b4a958a0 100755 --- a/app/api/controller/LocalStore.php +++ b/app/api/controller/LocalStore.php @@ -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;