export function getUserLocation(): Promise<{ lng: number; lat: number }> {
  return new Promise((resolve, reject) => {
    if (!navigator.geolocation) {
      reject(new Error('浏览器不支持定位'))
      return
    }
    navigator.geolocation.getCurrentPosition(
      (pos) => resolve({ lng: pos.coords.longitude, lat: pos.coords.latitude }),
      () => reject(new Error('定位失败')),
      { enableHighAccuracy: true, timeout: 10000, maximumAge: 300000 }
    )
  })
}
