mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-14 11:27:37 +08:00
🐛 轻雪天气获取空aqi值的异常错误
This commit is contained in:
parent
c063c69dea
commit
8809459f1b
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,6 +21,7 @@ liteyuki/resources/templates/latest-debug.html
|
|||||||
pyproject.toml
|
pyproject.toml
|
||||||
|
|
||||||
test.py
|
test.py
|
||||||
|
line_count.py
|
||||||
|
|
||||||
# nuitka
|
# nuitka
|
||||||
main.build/
|
main.build/
|
||||||
|
@ -52,6 +52,7 @@ def get_local_data(ulang_code: str) -> dict:
|
|||||||
"tomorrow" : ulang.get("weather.tomorrow"),
|
"tomorrow" : ulang.get("weather.tomorrow"),
|
||||||
"day" : ulang.get("weather.day"),
|
"day" : ulang.get("weather.day"),
|
||||||
"night" : ulang.get("weather.night"),
|
"night" : ulang.get("weather.night"),
|
||||||
|
"no_aqi" : ulang.get("weather.no_aqi"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,3 +9,4 @@ weather.day=Day
|
|||||||
weather.night=Night
|
weather.night=Night
|
||||||
weather.today=Today
|
weather.today=Today
|
||||||
weather.tomorrow=Tomorrow
|
weather.tomorrow=Tomorrow
|
||||||
|
weather.no_aqi=No AQI data
|
@ -9,3 +9,4 @@ weather.day=昼
|
|||||||
weather.night=夜
|
weather.night=夜
|
||||||
weather.today=今日
|
weather.today=今日
|
||||||
weather.tomorrow=明日
|
weather.tomorrow=明日
|
||||||
|
weather.no_aqi=空気質データなし
|
@ -9,3 +9,4 @@ weather.day=白天
|
|||||||
weather.night=夜晚
|
weather.night=夜晚
|
||||||
weather.today=今天
|
weather.today=今天
|
||||||
weather.tomorrow=明天
|
weather.tomorrow=明天
|
||||||
|
weather.no_aqi=暂无AQI数据
|
@ -28,6 +28,7 @@ let locationData = data["location"]
|
|||||||
|
|
||||||
// 处理aqi
|
// 处理aqi
|
||||||
let aqiValue = 0
|
let aqiValue = 0
|
||||||
|
if ("aqi" in aqi) {
|
||||||
aqi["aqi"].forEach(
|
aqi["aqi"].forEach(
|
||||||
(item) => {
|
(item) => {
|
||||||
if (item["defaultLocalAqi"]) {
|
if (item["defaultLocalAqi"]) {
|
||||||
@ -37,6 +38,11 @@ aqi["aqi"].forEach(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
document.getElementById("aqi-dot").style.backgroundColor = '#fff'
|
||||||
|
document.getElementById("aqi-data").innerText = localData['no_aqi']
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
templates = {
|
templates = {
|
||||||
"time": weatherNow["now"]["obsTime"],
|
"time": weatherNow["now"]["obsTime"],
|
||||||
|
@ -289,9 +289,9 @@ function main() {
|
|||||||
let mottoFrom = `${motto['author']} ${motto['source']}`
|
let mottoFrom = `${motto['author']} ${motto['source']}`
|
||||||
document.getElementById('motto-text').innerText = mottoText
|
document.getElementById('motto-text').innerText = mottoText
|
||||||
document.getElementById('motto-from').innerText = mottoFrom
|
document.getElementById('motto-from').innerText = mottoFrom
|
||||||
|
let text = document.createElement('div')
|
||||||
document.getElementById('author-description').innerText = localData['description'] + ' Powered by Liteyuki'
|
text.innerText = localData['description'] + ' Powered by Liteyuki'
|
||||||
|
document.getElementById('author-description').appendChild(text)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user