From fe712cc09c4a1c90390c6f04ce9d149b5849b0f3 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Tue, 20 Feb 2024 15:50:18 +0800 Subject: [PATCH] update --- xumu.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xumu.py b/xumu.py index 90d9595..664a67b 100644 --- a/xumu.py +++ b/xumu.py @@ -337,11 +337,9 @@ async def process_data(request: Request): async def past_seven_days(deviceId): try: current_date = datetime.now().date() - past_7_days_date = current_date - timedelta(days=7) tomorrow = current_date + timedelta(days=1) - if deviceId is None or deviceId == "" or len(deviceId) != 4: - return BaseResponse(code=500, msg="参数错误") - sql = f"select * from root.warning.{deviceId} where time >= {past_7_days_date} and time <= {tomorrow}" + past_6_days_date = current_date - timedelta(days=6) + sql = f"select MAX_VALUE(value) from root.warning.{deviceId} group by ([{past_6_days_date}, {tomorrow}), 1d)" send_json = { "sql": sql }