Browse Source

关闭旧推送接口

develop
wangsixiang 5 months ago
parent
commit
2db47563d7
  1. 16
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

16
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -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"), "请求失败");
}

Loading…
Cancel
Save