| | |
| | | } |
| | | |
| | | /** |
| | | * 获取节假日不含周末 |
| | | * |
| | | * @return |
| | | */ |
| | | public Map getWeather(String code) { |
| | | String url = "https://restapi.amap.com/v3/weather/weatherInfo?key=9e0d819935da8a01de0e476ba8a9019e&city="+code; |
| | | OkHttpClient client = new OkHttpClient(); |
| | | Response response; |
| | | //解密数据 |
| | | String rsa = null; |
| | | Request request = new Request.Builder() |
| | | .url(url) |
| | | .get() |
| | | .addHeader("Content-Type", "application/x-www-form-urlencoded") |
| | | .build(); |
| | | try { |
| | | response = client.newCall(request).execute(); |
| | | rsa = response.body().string(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return JSONObject.parseObject(rsa, Map.class); |
| | | } |
| | | |
| | | /** |
| | | * 获取周末 月从0开始 |
| | | * |
| | | * @param year |