From 66b64d44102c002f976b9d0b439eb3a3f684314e Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Wed, 24 Jan 2024 17:29:46 +0800 Subject: [PATCH] update --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index 821ce07..ddb84a7 100644 --- a/main.py +++ b/main.py @@ -22,23 +22,20 @@ class BaseResponse(BaseModel): # 设备注册实体 class Device(BaseModel): iccid: str = "" - deviceId: str = "" + deviceId: str type: int = None # 数据查询参数实体 class DataQuery(BaseModel): deviceId: str - limit: int = 1 - # 数据查询接口 @app.post("/api/xumu/data/query") async def data_query(params: DataQuery): try: deviceId = params.deviceId - limit = params.limit - sql = f"select * from root.farm.{deviceId} order by time desc limit {limit}" + sql = f"select last * from root.farm.{deviceId}" send_json = { "sql": sql } @@ -95,6 +92,9 @@ async def register(request: Request): deviceId = payload["d"] iccid = payload["cid"] type = payload["t"] + # TODO 检测该设备是否已经创建 + + # 创建该设备 send_json = { "devices": ["root.device"], "timestamps": [int(time.time() * 1000)],