update
This commit is contained in:
parent
66b64d4410
commit
03cfb675b5
|
@ -30,6 +30,7 @@ class Device(BaseModel):
|
|||
class DataQuery(BaseModel):
|
||||
deviceId: str
|
||||
|
||||
|
||||
# 数据查询接口
|
||||
@app.post("/api/xumu/data/query")
|
||||
async def data_query(params: DataQuery):
|
||||
|
@ -93,7 +94,14 @@ async def register(request: Request):
|
|||
iccid = payload["cid"]
|
||||
type = payload["t"]
|
||||
# TODO 检测该设备是否已经创建
|
||||
|
||||
device = Device(iccid=iccid, deviceId=deviceId, type=type)
|
||||
a_device = await get_device(device)
|
||||
print(a_device)
|
||||
if a_device.code == 200:
|
||||
v = a_device.data["values"]
|
||||
if len(v) != 0:
|
||||
print("该设备已经注册过了")
|
||||
return BaseResponse(code=302, msg="该设备已经注册过了")
|
||||
# 创建该设备
|
||||
send_json = {
|
||||
"devices": ["root.device"],
|
Loading…
Reference in New Issue