1
0
forked from bot/app

Merge remote-tracking branch 'origin/main'

This commit is contained in:
远野千束 2024-08-08 18:06:14 +08:00
commit 8ace3e68f4
2 changed files with 10 additions and 2 deletions

View File

@ -94,7 +94,8 @@ async def get_weather_now_card(matcher: Matcher, event: T_MessageEvent, keyword:
"weatherHourly": weather_hourly, "weatherHourly": weather_hourly,
"aqi" : aqi, "aqi" : aqi,
"location" : location_data.dump(), "location" : location_data.dump(),
"localization" : get_local_data(ulang.lang_code) "localization" : get_local_data(ulang.lang_code),
"is_dev": 1 if is_dev else 0
} }
}, },
) )

View File

@ -23,6 +23,7 @@ let weatherNow = data["weatherNow"]
let weatherDaily = data["weatherDaily"] let weatherDaily = data["weatherDaily"]
let weatherHourly = data["weatherHourly"] let weatherHourly = data["weatherHourly"]
let aqi = data["aqi"] let aqi = data["aqi"]
let is_dev = data["is_dev"]
let locationData = data["location"] let locationData = data["location"]
@ -34,9 +35,15 @@ if ("aqi" in aqi) {
if (item["defaultLocalAqi"]) { if (item["defaultLocalAqi"]) {
document.getElementById("aqi-data").innerText = "AQI " + item["valueDisplay"] + " " + item["category"] document.getElementById("aqi-data").innerText = "AQI " + item["valueDisplay"] + " " + item["category"]
// 将(255,255,255)这种格式的颜色设置给css // 将(255,255,255)这种格式的颜色设置给css
if(is_dev == 1){
//开发版
document.getElementById("aqi-dot").style.backgroundColor = "rgb(" + item["color"]['red'] + "," + item["color"]['green'] + "," + item["color"]['blue'] + "," + item["color"]['alpha'] + ")"
}else{
//正式版
document.getElementById("aqi-dot").style.backgroundColor = "rgb(" + item["color"] + ")" document.getElementById("aqi-dot").style.backgroundColor = "rgb(" + item["color"] + ")"
} }
} }
}
) )
} else { } else {
document.getElementById("aqi-dot").style.backgroundColor = '#fff' document.getElementById("aqi-dot").style.backgroundColor = '#fff'