This commit is contained in:
DingZQ
2025-05-17 22:13:22 +08:00
parent e97049eb30
commit b9cd42ed76

13
main.py
View File

@@ -2734,16 +2734,23 @@ class Download_History_Data_Manually(BaseModel):
""" """
download_date: datetime download_date: datetime
# DingZQ, 2025-05-17
@app.post("/download_history_data_manually/") @app.post("/download_history_data_manually/")
async def fastapi_download_history_data_manually(data: Download_History_Data_Manually) -> None: async def fastapi_download_history_data_manually(data: Download_History_Data_Manually) -> None:
item = data.dict() item = data.dict()
# 创建东八区时区对象 # 创建东八区时区对象
tz = timezone(timedelta(hours=8)) tz = timezone(timedelta(hours=8))
begin_time = datetime.combine(item['download_date'].date(), time.min).replace(tzinfo=tz) begin_dt = datetime.combine(item['download_date'].date(), time.min).replace(tzinfo=tz)
end_time = datetime.combine(item['download_date'].date(), time(23, 59, 59)).replace(tzinfo=tz) end_dt = datetime.combine(item['download_date'].date(), time(23, 59, 59)).replace(tzinfo=tz)
# 2. 转为字符串
begin_time = begin_dt.isoformat()
end_time = end_dt.isoformat()
influxdb_api.download_history_data_manually(begin_time=begin_time, end_time=end_time) influxdb_api.download_history_data_manually(begin_time=begin_time, end_time=end_time)
# DingZQ, 2025-05-17
class Run_Simulation_Manually_by_Date(BaseModel): class Run_Simulation_Manually_by_Date(BaseModel):
""" """
name数据库名称 name数据库名称