From b9cd42ed764cf3be9178fccd83bf24ec635d62bb Mon Sep 17 00:00:00 2001 From: DingZQ Date: Sat, 17 May 2025 22:13:22 +0800 Subject: [PATCH] Refine --- main.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index fca55d8..1e5ecac 100644 --- a/main.py +++ b/main.py @@ -2734,16 +2734,23 @@ class Download_History_Data_Manually(BaseModel): """ download_date: datetime - +# DingZQ, 2025-05-17 @app.post("/download_history_data_manually/") async def fastapi_download_history_data_manually(data: Download_History_Data_Manually) -> None: item = data.dict() # 创建东八区时区对象 tz = timezone(timedelta(hours=8)) - begin_time = 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) + begin_dt = datetime.combine(item['download_date'].date(), time.min).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) + +# DingZQ, 2025-05-17 class Run_Simulation_Manually_by_Date(BaseModel): """ name:数据库名称