Browse Source

优化天气服务返回信息

develop
zhaoxianglong 7 months ago
parent
commit
34d2384b1a
  1. 3
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

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

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

Loading…
Cancel
Save