import request from '@/utils/request'
import settings from '@/settings'
// 高德
export default {
// 根据ip获取定位
getPosition(ip, key = settings.amapServiceKey) { // 高德web服务key
return request({
url: `https://restapi.amap.com/v3/ip`,
method: 'get',
params: {
ip,
output: 'json',
key
}
})
},
// 根据城市编码获取天气
getWeather(city, key = settings.amapServiceKey) { // 高德web服务key
return request({
url: `https://restapi.amap.com/v3/weather/weatherInfo?city=${city}&key=${key}`,
method: 'get'
})
}
}