From 56a6e0f30f91ea555fe5752e40a033d5f536a158 Mon Sep 17 00:00:00 2001 From: Yao <734770036@qq.com> Date: Sat, 28 Sep 2024 16:14:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9C=B0=E5=9D=80=E7=BB=8F?= =?UTF-8?q?=E7=BA=AC=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/GetLocation.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/api/controller/GetLocation.php diff --git a/app/api/controller/GetLocation.php b/app/api/controller/GetLocation.php new file mode 100644 index 00000000..6a2bdb9f --- /dev/null +++ b/app/api/controller/GetLocation.php @@ -0,0 +1,26 @@ +request->post(); + $url = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . ConfigServer::get('map', 'tx_map_key') . '&address=' . $post['address']; + $result = file_get_contents($url); + $data = json_decode($result, true); + if ($data['message'] == 'Success') { + return JsonServer::success('', $data['result']['location']); + } + + return JsonServer::error('获取失败'); + + } + +} \ No newline at end of file