This commit is contained in:
xyj 2024-01-26 09:15:19 +08:00
parent e5a0a6b18b
commit 06e0335531
1 changed files with 1 additions and 11 deletions

12
xumu.py
View File

@ -19,13 +19,6 @@ class BaseResponse(BaseModel):
data: Any = None data: Any = None
# 设备注册实体
class Device(BaseModel):
iccid: str = ""
deviceId: str
type: int = None
@app.get("/api/xumu/video") @app.get("/api/xumu/video")
async def data_query(username): async def data_query(username):
return BaseResponse(data=get_video_url(username)) return BaseResponse(data=get_video_url(username))
@ -132,9 +125,7 @@ async def register(request: Request):
iccid = payload["cid"] iccid = payload["cid"]
type = payload["t"] type = payload["t"]
# 该设备是否已经创建 # 该设备是否已经创建
device = Device(iccid=iccid, deviceId=deviceId, type=type) a_device = await get_device(iccid, deviceId)
a_device = await get_device(device)
print(a_device)
if a_device.code == 200: if a_device.code == 200:
v = a_device.data["values"] v = a_device.data["values"]
if len(v) != 0: if len(v) != 0:
@ -159,7 +150,6 @@ async def register(request: Request):
} }
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
res.append(r.json()) res.append(r.json())
print(res)
return BaseResponse(data=res) return BaseResponse(data=res)
except Exception as e: except Exception as e:
return BaseResponse(code=500, msg=str(e)) return BaseResponse(code=500, msg=str(e))