From 5e76e53885145b1f8e58f703383ba44b662930ff Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Tue, 20 Feb 2024 14:48:28 +0800 Subject: [PATCH] statistics --- test.py | 6 ++++++ xumu.py | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..5ef2ffe --- /dev/null +++ b/test.py @@ -0,0 +1,6 @@ +from datetime import datetime, timedelta + +current_date = datetime.now().date() +tomorrow = current_date + timedelta(days=1) +past_7_days_date = current_date - timedelta(days=7) +print(tomorrow) \ No newline at end of file diff --git a/xumu.py b/xumu.py index 2264cf2..0bfb23b 100644 --- a/xumu.py +++ b/xumu.py @@ -336,9 +336,10 @@ 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 <= {current_date}" + sql = f"select * from root.warning.{deviceId} where time >= {past_7_days_date} and time <= {tomorrow}" send_json = { "sql": sql }