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):
|
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)
|
|
||||||
tomorrow = current_date + timedelta(days=1)
|
tomorrow = current_date + timedelta(days=1)
|
||||||
if deviceId is None or deviceId == "" or len(deviceId) != 4:
|
past_6_days_date = current_date - timedelta(days=6)
|
||||||
return BaseResponse(code=500, msg="参数错误")
|
sql = f"select MAX_VALUE(value) from root.warning.{deviceId} group by ([{past_6_days_date}, {tomorrow}), 1d)"
|
||||||
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