statistics
This commit is contained in:
parent
7e1c63b4ec
commit
5e76e53885
|
@ -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)
|
3
xumu.py
3
xumu.py
|
@ -336,9 +336,10 @@ async def past_seven_days(deviceId):
|
||||||
try:
|
try:
|
||||||
current_date = datetime.now().date()
|
current_date = datetime.now().date()
|
||||||
past_7_days_date = current_date - timedelta(days=7)
|
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:
|
if deviceId is None or deviceId == "" or len(deviceId) != 4:
|
||||||
return BaseResponse(code=500, msg="参数错误")
|
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 = {
|
send_json = {
|
||||||
"sql": sql
|
"sql": sql
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue