import { weatherHttp } from '/@/utils/http/axios'

const API_KEY = '4fb5c9e814994516b6522419651f2e9e'

// 查询实况天气
export function now(location: string) {
    return weatherHttp.get({
        url: `/v7/weather/now?key=${API_KEY}&location=${location}`,
    })
}

// 获取天气预报
export function forecast(location: string, day = 7) {
    return weatherHttp.get({
        url: `/v7/weather/${day}d?key=${API_KEY}&location=${location}`,
    })
}

// 获取气象预警信息
export function alarm(location: string) {
    return weatherHttp.get({
        url: `/weatheralert/v1/current/${location.replace(',', '/')}?key=${API_KEY}`,
    })
}
