guonan
2025-07-10 746d939d885ef2239455b2278810ac4ad6d94b40
src/api/hpApi.js
@@ -248,7 +248,7 @@
}
// 查询孙胡沟避险场所
export async function getSafePoint(data) {
export async function getSafePoint() {
  const response = await axios.get("/hp/safeHavenLocation/getDataSelect", {
    params: {
      divisionId: 110116110218
@@ -261,4 +261,26 @@
export async function getAllCode() {
  const response = await axios.get("/hp/district/getAll");
  return response.data;
}
// 获取天气预报
export async function getWeather() {
  // 获取当前时间戳
  const currentTimestamp = Date.now();
  // 创建Date对象
  const currentDate = new Date(currentTimestamp);
  // 格式化为年-月-日(YYYY-MM-DD)
  const year = currentDate.getFullYear();
  const month = String(currentDate.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要+1
  const day = String(currentDate.getDate()).padStart(2, '0');
  const formattedDate = `${year}-${month}-${day}`;
  const response = await axios.get("/hp/weatherForecast/getSevenDaysWeather", {
    params: {
      inputDate: formattedDate
    }
  });
  return response.data;
}