新浪天氣接口那是公認的好,可是百度之後發現很簡陋,所以自己寫了工具類,此處幫忙測試下其中的天氣接口,看有哪些地方要改進的。
Jar 名称: NonentityUtil
Class 名称: SinaWeatherUtil,新浪天氣 Util 類
方法名: getWeatherByCity(String city,int forecastDays),根據城市獲取天氣
輸入參數: city,城市,拼音或者漢語(【BUG】輸入拼音返回的城市也是拼音);
forecastDays,天氣以預報天數,默認 11 天(包括今天)
輸出參數: Map<String, Object> weathers,天氣集合
集合項 | 說明 | |
continents | 洲,大陸 | |
country | 國家 | |
city | 城市 | |
updateTime | 更新時間 | |
temperature | 溫度 | |
weather | 天氣 | |
windDirection | 風向 | |
hummidity | 濕度 | |
airPollutionIndex | 當前空氣質量指數 | |
airPollutionStatus | 當前空氣質量狀況 | |
warnColor | 預警顏色 | |
warnName | 預警名稱 | |
hourlyTemperatures | 24 小時天氣/逐時溫度 | |
| time | 時間 |
| weather | 天氣 |
| temperature | 溫度 |
weatherForecasts | 天氣預報 | |
| date | 日期 |
| week | 星期 |
| daytimeWeather | 白天天氣 |
| nightWeather | 夜間天氣 |
| daytimeTemperature | 白天溫度 |
| nightTemperature | 夜間溫度 |
| windDirection | 風向 |
| airPollutionIndex | 空氣質量指數 |
| airPollutionStatus | 空氣質量狀況 |
sunrise | 日出 | |
sunset | 日落 | |
dress | 穿衣 | |
exercise | 運動 | |
clod | 感冒 | |
carWash | 洗車 |