From c098f1e3a3e052aa3d65584aae6dc003a70d75ad Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期二, 16 十二月 2025 00:09:14 +0800
Subject: [PATCH] feat: 停止轮询 uncount
---
app/api/map.js | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 167 insertions(+), 4 deletions(-)
diff --git a/app/api/map.js b/app/api/map.js
index ed85e5b..bbd122c 100644
--- a/app/api/map.js
+++ b/app/api/map.js
@@ -8,7 +8,8 @@
}
return request({
- url: '/system/gps/address/search',
+// url: '/system/gps/address/search',
+ url: '/system/gps/tianditu/place/suggestion',
method: 'get',
params: {
keyword: keyword,
@@ -28,9 +29,12 @@
if (isNaN(lat) || isNaN(lng)) {
return Promise.reject(new Error('鍙傛暟鏃犳晥锛岀粡绾害鍧愭爣鏍煎紡閿欒'))
}
-
+ /**
+ * 杩欓噷鐢ㄥ埌澶╁湴鍥�
+ */
return request({
- url: '/system/gps/address/geocoder',
+ // url: '/system/gps/address/geocoder',
+ url: '/system/gps/tianditu/reverseGeocoding',
method: 'get',
params: {
lat: lat,
@@ -39,6 +43,21 @@
})
}
+export function calculateTianDiTuDistance(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
+ }
+ })
+}
// 鍦板浘璺嚎瑙勫垝API锛堣绠椾袱鐐归棿璺濈锛�
export function calculateDistance(fromLat, fromLng, toLat, toLng) {
// 鍙傛暟楠岃瘉
@@ -56,6 +75,7 @@
return request({
url: '/system/gps/route/distance',
+ // url: '/system/gps/tianditu/byAddress',
method: 'get',
params: {
fromLat: fromLat,
@@ -84,6 +104,9 @@
}
})
}
+
+// 鍒悕锛屼笌baiduGeocoding鍔熻兘鐩稿悓
+export const baiduGeocode = baiduGeocoding
// 鐧惧害鍦板浘璺嚎瑙勫垝API锛堣绠椾袱涓潗鏍囦箣闂寸殑椹捐溅璺濈锛�
export function baiduRouteDriving(origin, destination) {
@@ -126,4 +149,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