update
This commit is contained in:
parent
7d78859fd6
commit
fe712cc09c
6
xumu.py
6
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue