|
|
@ -96,7 +96,13 @@ public class WeatherForecastController extends BaseController { |
|
|
|
|
|
|
|
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
|
if (jsonResult.getInteger("code") == 200) { |
|
|
|
return AjaxResult.success(jsonResult.getJSONArray("data")); |
|
|
|
JSONArray data = jsonResult.getJSONArray("data"); |
|
|
|
if (data.size() != 0) { |
|
|
|
redisCache.setCacheList("currentWeatherAndForecastInformation", data); |
|
|
|
return AjaxResult.success(data); |
|
|
|
} else { |
|
|
|
return AjaxResult.success(redisCache.getCacheList("currentWeatherAndForecastInformation")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); |
|
|
|
} |
|
|
@ -154,7 +160,13 @@ public class WeatherForecastController extends BaseController { |
|
|
|
|
|
|
|
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
|
if (jsonResult.getInteger("code") == 200) { |
|
|
|
return AjaxResult.success(jsonResult.getJSONArray("data")); |
|
|
|
JSONArray data = jsonResult.getJSONArray("data"); |
|
|
|
if (data.size() != 0) { |
|
|
|
redisCache.setCacheList("currentWeatherWarningInformationQuery", data); |
|
|
|
return AjaxResult.success(data); |
|
|
|
} else { |
|
|
|
return AjaxResult.success(redisCache.getCacheList("currentWeatherWarningInformationQuery")); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); |
|
|
|
} |
|
|
|