Browse Source

优化天气服务接口

develop
zhaoxianglong 7 months ago
parent
commit
5065313971
  1. 2
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

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

@ -104,6 +104,7 @@ public class WeatherForecastController extends BaseController {
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) { if (jsonResult.getInteger("code") == 200) {
jsonObject.put("name",dcRegion.getRegionName());
jsonObject.put(weather.getString("METEOROLOGICALEARLYWARNING") + dcRegion.getId(), extracted(jsonResult,"warning")); jsonObject.put(weather.getString("METEOROLOGICALEARLYWARNING") + dcRegion.getId(), extracted(jsonResult,"warning"));
} else { } else {
@ -177,6 +178,7 @@ public class WeatherForecastController extends BaseController {
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); JSONObject jsonResult = JSONObject.parseObject(response.body().string());
if (jsonResult.getInteger("code") == 200) { if (jsonResult.getInteger("code") == 200) {
jsonObject.put("name",dcRegion.getRegionName());
if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) {
jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now")); jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now"));

Loading…
Cancel
Save