大屏未来三天天气预报
This commit is contained in:
parent
decde473dd
commit
7da4af075c
@ -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);
|
||||
|
@ -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对象,提取所需的天气信息
|
||||
|
Loading…
Reference in New Issue
Block a user