|
@@ -36,12 +36,16 @@ public class WeatherController {
|
|
|
|
|
|
@GetMapping("/getWeather")
|
|
|
public JSONObject weather() {
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
String result = HttpUtil.get(API_URL + "?district_id=" + district_id + "&data_type=" + data_type + "&ak=" + ak);
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
if (jsonObject.get("status").toString().equals("0")) {
|
|
|
- return jsonObject;
|
|
|
+ json.put("code",200);
|
|
|
+ json.put("msg","查询成功");
|
|
|
+ json.put("data",jsonObject.get("result"));
|
|
|
+ return json;
|
|
|
} else {
|
|
|
- return JSONObject.parseObject("{\"status\":1,\"message\":\"获取气象信息失败,请稍候检查网络或稍后重试\"}");
|
|
|
+ return JSONObject.parseObject("{\"code\":1,\"msg\":\"获取气象信息失败,请稍候检查网络或稍后重试\"}");
|
|
|
}
|
|
|
}
|
|
|
}
|