24小时查的到,但是3天七天却查不到信息,这是为啥,明明是同样的代码
if(a==1){
System.out.print("请输入城市名称查询24小时天气预报:");
String city=in.next();
WeatherUtils weatherUtils =new WeatherUtilsImpl();
List<HourWeather> weatherList=weatherUtils.w24h("0d8abeeafc364b5aaa73b7e52ceb83ba", city);
// System.out.println(weatherList);
if(weatherList.size()==0){
System.out.println("未查询到数据");
}else{
for(HourWeather hourWeather:weatherList){
String template="%s月%s日%s时|%-3s|%-20s|%-8s|%-4s";
String row=String.format(template, new String[]{
hourWeather.getMonth(),
hourWeather.getDay(),
hourWeather.getHour(),
hourWeather.getWindDirection(),
hourWeather.getWindPower(),
hourWeather.getWeather(),
hourWeather.getTemperature()
});
System.out.println(row);
}
}
}else if(a==2){
System.out.print("请输入城市名称查询3天天气预报:");
String city=in.next();
WeatherUtils weatherUtils =new WeatherUtilsImpl();
List<DayWeather> weatherList=weatherUtils.w3d("0d8abeeafc364b5aaa73b7e52ceb83ba", city);
// System.out.println(weatherList);
if(weatherList.size()==0){
System.out.println("未查询到信息");
}else{
for(DayWeather weather:weatherList){
String template="%-2s月%-2s日|气温:%s(日)%s(夜)|天气:%s(日)%s(夜)|风力:%s(日)%s(夜)";
String row =String.format(template, new String[]{
weather.getMonth(),
weather.getDay(),
weather.getDayAirTemperature(),
weather.getNightAirTemperature(),
weather.getDayWeather(),
weather.getNightWeather(),
weather.getDayWindPower(),
weather.getNightWindPower()
});
System.out.println(row);
}
}
}else if(a==3){
System.out.print("请输入城市名称查询7天天气预报:");
String city=in.next();
WeatherUtils weatherUtils =new WeatherUtilsImpl();
List<DayWeather> weatherList=weatherUtils.w7d("0d8abeeafc364b5aaa73b7e52ceb83ba", city);
// System.out.println(weatherList);
if(weatherList.size()==0){
System.out.println("未查询到信息");
}else{
for(DayWeather weather:weatherList){
String template="%-2s月%-2s日|气温:%s(日)%s(夜)|天气:%s(日)%s(夜)|风力:%s(日)%s(夜)";
String row =String.format(template, new String[]{
weather.getMonth(),
weather.getDay(),
weather.getDayAirTemperature(),
weather.getNightAirTemperature(),
weather.getDayWeather(),
weather.getNightWeather(),
weather.getDayWindPower(),
weather.getNightWindPower()
});
System.out.println(row);
}
}
}