mirror of
				https://github.com/LiteyukiStudio/LiteyukiBot.git
				synced 2025-10-26 09:56:25 +00:00 
			
		
		
		
	🐛 轻雪天气获取空aqi值的异常错误
This commit is contained in:
		| @@ -52,6 +52,7 @@ def get_local_data(ulang_code: str) -> dict: | ||||
|             "tomorrow" : ulang.get("weather.tomorrow"), | ||||
|             "day"      : ulang.get("weather.day"), | ||||
|             "night"    : ulang.get("weather.night"), | ||||
|             "no_aqi"   : ulang.get("weather.no_aqi"), | ||||
|     } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -8,4 +8,5 @@ weather.sunday=Sun | ||||
| weather.day=Day | ||||
| weather.night=Night | ||||
| weather.today=Today | ||||
| weather.tomorrow=Tomorrow | ||||
| weather.tomorrow=Tomorrow | ||||
| weather.no_aqi=No AQI data | ||||
| @@ -8,4 +8,5 @@ weather.sunday=日 | ||||
| weather.day=昼 | ||||
| weather.night=夜 | ||||
| weather.today=今日 | ||||
| weather.tomorrow=明日 | ||||
| weather.tomorrow=明日 | ||||
| weather.no_aqi=空気質データなし | ||||
| @@ -8,4 +8,5 @@ weather.sunday=周日 | ||||
| weather.day=白天 | ||||
| weather.night=夜晚 | ||||
| weather.today=今天 | ||||
| weather.tomorrow=明天 | ||||
| weather.tomorrow=明天 | ||||
| weather.no_aqi=暂无AQI数据 | ||||
| @@ -28,15 +28,21 @@ let locationData = data["location"] | ||||
|  | ||||
| // 处理aqi | ||||
| let aqiValue = 0 | ||||
| aqi["aqi"].forEach( | ||||
|     (item) => { | ||||
|         if (item["defaultLocalAqi"]) { | ||||
|             document.getElementById("aqi-data").innerText = "AQI " + item["valueDisplay"] + " " + item["category"] | ||||
|             // 将(255,255,255)这种格式的颜色设置给css | ||||
|             document.getElementById("aqi-dot").style.backgroundColor = "rgb(" + item["color"] + ")" | ||||
| if ("aqi" in aqi) { | ||||
|     aqi["aqi"].forEach( | ||||
|         (item) => { | ||||
|             if (item["defaultLocalAqi"]) { | ||||
|                 document.getElementById("aqi-data").innerText = "AQI " + item["valueDisplay"] + " " + item["category"] | ||||
|                 // 将(255,255,255)这种格式的颜色设置给css | ||||
|                 document.getElementById("aqi-dot").style.backgroundColor = "rgb(" + item["color"] + ")" | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| ) | ||||
|     ) | ||||
| } else { | ||||
|     document.getElementById("aqi-dot").style.backgroundColor = '#fff' | ||||
|     document.getElementById("aqi-data").innerText = localData['no_aqi'] | ||||
| } | ||||
|  | ||||
|  | ||||
| templates = { | ||||
|     "time": weatherNow["now"]["obsTime"], | ||||
| @@ -92,7 +98,7 @@ weatherDaily['daily'].forEach( | ||||
|             return | ||||
|         } | ||||
|         let today = days[index] | ||||
|         if (index >= 2){ | ||||
|         if (index >= 2) { | ||||
|             today += `(${item["fxDate"].split("-")[1]}.${item["fxDate"].split("-")[2]})` | ||||
|         } | ||||
|         let dailyItemDiv = document.importNode(document.getElementById("daily-item-template").content, true) | ||||
|   | ||||
| @@ -289,9 +289,9 @@ function main() { | ||||
|     let mottoFrom = `${motto['author']} ${motto['source']}` | ||||
|     document.getElementById('motto-text').innerText = mottoText | ||||
|     document.getElementById('motto-from').innerText = mottoFrom | ||||
|  | ||||
|     document.getElementById('author-description').innerText = localData['description'] + ' Powered by Liteyuki' | ||||
|  | ||||
|     let text = document.createElement('div') | ||||
|     text.innerText = localData['description'] + ' Powered by Liteyuki' | ||||
|     document.getElementById('author-description').appendChild(text) | ||||
|  | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user