天气订阅功能优化
This commit is contained in:
@@ -543,12 +543,11 @@ class WeatherPlugin(MessagePluginInterface):
|
||||
if not self.redis_manager: return
|
||||
try:
|
||||
today_fc = api_data.get('daily_forecast', [])[0]
|
||||
data = {
|
||||
"date": datetime.datetime.now().strftime("%Y-%m-%d"),
|
||||
"tempMax": today_fc['tempMax'],
|
||||
"tempMin": today_fc['tempMin'],
|
||||
"text": today_fc['textDay']
|
||||
}
|
||||
# 保存完整的接口数据
|
||||
data = today_fc.copy()
|
||||
# 补充 date 字段,方便后续处理
|
||||
data["date"] = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||
|
||||
self.redis_manager.save_history(city_id, data)
|
||||
except Exception as e:
|
||||
self.LOG.error(f"存档失败: {e}")
|
||||
|
||||
Reference in New Issue
Block a user