大屏未来三天天气预报

This commit is contained in:
sonjinyon 2024-08-22 10:06:59 +08:00
parent decde473dd
commit 7da4af075c
2 changed files with 3 additions and 2 deletions

View File

@ -36,7 +36,7 @@ public class WeatherApi {
*/
@GetMapping(value = "/getFutureWeather")
public ResponseVO getFutureWeather(String cityCode) {
String weatherData = GoodWeatherUtil.getWeatherData(cityCode);
String weatherData = GoodWeatherUtil.getFutureWeather(cityCode);
JSONObject dataOfJson = JSONObject.parseObject(weatherData);
JSONArray forecasts = dataOfJson.getJSONArray("forecasts");
return new ResponseVO(200,"",forecasts,0);

View File

@ -52,6 +52,7 @@ public class GoodWeatherUtil {
}
/**
* 获取未来三天天气预报
* @param cityCode
@ -83,6 +84,7 @@ public class GoodWeatherUtil {
}
/*
* 将JSON格式数据进行解析 返回一个weather对象
*/
@ -90,7 +92,6 @@ public class GoodWeatherUtil {
if ("500".equals(weatherInfobyJson)){
return null;
}
JSONObject dataOfJson = JSONObject.parseObject(weatherInfobyJson);
System.out.println(dataOfJson);
//创建WeatherInfo对象提取所需的天气信息