From cdcc529ce5fb9aa0dd1dea5bb2a620fc09b7d25c Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期六, 08 十一月 2025 20:03:56 +0800
Subject: [PATCH] feat: 上传附件

---
 app/api/map.js |   66 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/app/api/map.js b/app/api/map.js
index df91db0..ed85e5b 100644
--- a/app/api/map.js
+++ b/app/api/map.js
@@ -46,12 +46,12 @@
       fromLng === undefined || fromLng === null ||
       toLat === undefined || toLat === null ||
       toLng === undefined || toLng === null) {
-    return Promise.reject(new Error('鍙傛暟涓嶅畬鏁达紝缂哄皯璧风偣鎴栫粓鐐瑰潗鏍�'))
+    return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯璧风偣鎴栫粓鐐瑰潗鏍�'))
   }
   
   // 妫�鏌ュ弬鏁版湁鏁堟��
   if (isNaN(fromLat) || isNaN(fromLng) || isNaN(toLat) || isNaN(toLng)) {
-    return Promise.reject(new Error('鍙傛暟鏃犳晥锛屽潗鏍囨牸寮忛敊璇�'))
+    return Promise.reject(new Error('鍙傛暟鏃犳晥,鍧愭爣鏍煎紡閿欒'))
   }
   
   return request({
@@ -64,4 +64,66 @@
       toLng: toLng
     }
   })
+}
+
+// ==================== 鐧惧害鍦板浘鎺ュ彛 ====================
+
+// 鐧惧害鍦板浘鍦扮悊缂栫爜API锛堝湴鍧�杞潗鏍囷級
+export function baiduGeocoding(address, city) {
+  // 鍙傛暟楠岃瘉
+  if (!address) {
+    return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯鍦板潃淇℃伅'))
+  }
+  
+  return request({
+    url: '/system/gps/baidu/geocoding',
+    method: 'get',
+    params: {
+      address: address,
+      city: city
+    }
+  })
+}
+
+// 鐧惧害鍦板浘璺嚎瑙勫垝API锛堣绠椾袱涓潗鏍囦箣闂寸殑椹捐溅璺濈锛�
+export function baiduRouteDriving(origin, destination) {
+  // 鍙傛暟楠岃瘉
+  if (!origin || !destination) {
+    return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯璧风偣鎴栫粓鐐瑰潗鏍�'))
+  }
+  
+  // 楠岃瘉鍧愭爣鏍煎紡锛堢含搴�,缁忓害锛�
+  const originParts = origin.split(',')
+  const destParts = destination.split(',')
+  if (originParts.length !== 2 || destParts.length !== 2) {
+    return Promise.reject(new Error('鍧愭爣鏍煎紡閿欒,搴斾负:绾害,缁忓害'))
+  }
+  
+  return request({
+    url: '/system/gps/baidu/route/driving',
+    method: 'get',
+    params: {
+      origin: origin,
+      destination: destination
+    }
+  })
+}
+
+// 鐧惧害鍦板浘璁$畻涓や釜鍦板潃涔嬮棿鐨勮窛绂伙紙缁勫悎鎺ュ彛锛氬湴鍧�杞潗鏍� + 璺嚎瑙勫垝锛�
+export function baiduDistanceByAddress(fromAddress, fromCity, toAddress, toCity) {
+  // 鍙傛暟楠岃瘉
+  if (!fromAddress || !toAddress) {
+    return Promise.reject(new Error('鍙傛暟涓嶅畬鏁�,缂哄皯璧风偣鎴栫粓鐐瑰湴鍧�'))
+  }
+  
+  return request({
+    url: '/system/gps/baidu/distance/byAddress',
+    method: 'get',
+    params: {
+      fromAddress: fromAddress,
+      fromCity: fromCity,
+      toAddress: toAddress,
+      toCity: toCity
+    }
+  })
 }
\ No newline at end of file

--
Gitblit v1.9.1