From fd047fa7234dc11643dab8ecbf38e8d7a8ba0854 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 22 十一月 2025 23:48:12 +0800
Subject: [PATCH] feat:修改任务
---
app/api/map.js | 142 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 141 insertions(+), 1 deletions(-)
diff --git a/app/api/map.js b/app/api/map.js
index ed85e5b..163ff1d 100644
--- a/app/api/map.js
+++ b/app/api/map.js
@@ -126,4 +126,144 @@
toCity: toCity
}
})
-}
\ No newline at end of file
+}
+
+// 鐧惧害鍦板浘鍦板潃鎼滅储鎻愮ずAPI锛堣緭鍏ヨ仈鎯筹級
+export function baiduPlaceSuggestion(query, region) {
+ // 鍙傛暟楠岃瘉
+ if (!query) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯鎼滅储鍏抽敭璇�'))
+ }
+
+ return request({
+ url: '/system/gps/baidu/place/suggestion',
+ method: 'get',
+ params: {
+ query: query,
+ region: region || '骞垮窞'
+ }
+ })
+}
+
+// ==================== 澶╁湴鍥炬帴鍙� ====================
+
+// 澶╁湴鍥惧湴鐞嗙紪鐮丄PI锛堝湴鍧�杞潗鏍囷級
+export function tiandituGeocoding(address) {
+ // 鍙傛暟楠岃瘉
+ if (!address) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯鍦板潃淇℃伅'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/geocoding',
+ method: 'get',
+ params: {
+ address: address
+ }
+ })
+}
+
+// 澶╁湴鍥鹃�嗗湴鐞嗙紪鐮丄PI锛堝潗鏍囪浆鍦板潃锛�
+export function tiandituReverseGeocoding(lon, lat) {
+ // 鍙傛暟楠岃瘉
+ if (lat === undefined || lat === null || lon === undefined || lon === null) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯缁忕含搴﹀潗鏍�'))
+ }
+
+ // 妫�鏌ュ弬鏁版湁鏁堟��
+ if (isNaN(lat) || isNaN(lon)) {
+ return Promise.reject(new Error('鍙傛暟鏃犳晥,缁忕含搴﹀潗鏍囨牸寮忛敊璇�'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/reverseGeocoding',
+ method: 'get',
+ params: {
+ lon: lon,
+ lat: lat
+ }
+ })
+}
+
+// 澶╁湴鍥綪OI鎼滅储API
+export function tiandituPlaceSearch(keyWord, queryType, level, mapBound, start, count) {
+ // 鍙傛暟楠岃瘉
+ if (!keyWord) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯鎼滅储鍏抽敭璇�'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/place/search',
+ method: 'get',
+ params: {
+ keyWord: keyWord,
+ queryType: queryType || '1',
+ level: level,
+ mapBound: mapBound,
+ start: start || 0,
+ count: count || 10
+ }
+ })
+}
+
+// 澶╁湴鍥鹃┚杞﹁矾寰勮鍒扐PI
+export function tiandituRouteDriving(orig, dest, mid, style) {
+ // 鍙傛暟楠岃瘉
+ if (!orig || !dest) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯璧风偣鎴栫粓鐐瑰潗鏍�'))
+ }
+
+ // 楠岃瘉鍧愭爣鏍煎紡锛堢粡搴�,绾害锛�
+ const origParts = orig.split(',')
+ const destParts = dest.split(',')
+ if (origParts.length !== 2 || destParts.length !== 2) {
+ return Promise.reject(new Error('鍧愭爣鏍煎紡閿欒,搴斾负:缁忓害,绾害'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/route/driving',
+ method: 'get',
+ params: {
+ orig: orig,
+ dest: dest,
+ mid: mid,
+ style: style || '0'
+ }
+ })
+}
+
+// 澶╁湴鍥捐绠椾袱涓湴鍧�涔嬮棿鐨勮窛绂伙紙缁勫悎鎺ュ彛锛氬湴鍧�杞潗鏍� + 璺緞瑙勫垝锛�
+export function tiandituDistanceByAddress(fromAddress, toAddress) {
+ // 鍙傛暟楠岃瘉
+ if (!fromAddress || !toAddress) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯璧风偣鎴栫粓鐐瑰湴鍧�'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/distance/byAddress',
+ method: 'get',
+ params: {
+ fromAddress: fromAddress,
+ toAddress: toAddress
+ }
+ })
+}
+
+// 澶╁湴鍥炬櫘閫氭悳绱㈡湇鍔PI锛堝湴鍧�鎼滅储锛�
+export function tiandituPlaceSuggestion(keyWord, region, city, count) {
+ // 鍙傛暟楠岃瘉
+ if (!keyWord) {
+ return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯鎼滅储鍏抽敭璇�'))
+ }
+
+ return request({
+ url: '/system/gps/tianditu/place/suggestion',
+ method: 'get',
+ params: {
+ keyWord: keyWord,
+ region: region,
+ city: city,
+ count: count || 10
+ }
+ })
+}
--
Gitblit v1.9.1