From eb82684152ffb0acddf67da92e4533a0190eb258 Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期五, 10 十月 2025 18:27:31 +0800 Subject: [PATCH] 对接口 --- server/system_service/src/main/java/com/doumee/core/utils/WeatherUtil.java | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/server/system_service/src/main/java/com/doumee/core/utils/WeatherUtil.java b/server/system_service/src/main/java/com/doumee/core/utils/WeatherUtil.java new file mode 100644 index 0000000..9322a46 --- /dev/null +++ b/server/system_service/src/main/java/com/doumee/core/utils/WeatherUtil.java @@ -0,0 +1,29 @@ +package com.doumee.core.utils; + +import lombok.extern.slf4j.Slf4j; + +/** + * Created by IntelliJ IDEA. + * + * @Author : Rk + * @create 2025/10/10 11:31 + */ +@Slf4j +public class WeatherUtil { + + //API鍦板潃锛� https://dev.qweather.com/docs/api/warning/weather-warning/ + private static final String apiPath = "/v7/warning/now"; + + public static String getWeatherWarningInfo(String apiUrl,String apiKey,String location){ + String url = apiUrl + apiPath + "?key=" + apiKey + "&location=" + location; + log.error(DateUtil.getCurrDateTime() + "澶╂皵璇锋眰鍦板潃锛�"+url); + String response = HttpsUtil.get(url,false); + log.error(DateUtil.getCurrDateTime() + "澶╂皵璇锋眰杩斿洖锛�"+response); + return response; + } + + + + + +} -- Gitblit v1.9.3