This commit is contained in:
xyj 2024-01-26 17:22:01 +08:00
parent 42ad6f07ac
commit 6835697380
1 changed files with 4 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import re
import time
import json
from typing import Any
@ -261,8 +262,9 @@ async def process_data(request: Request):
data = json.loads(data)
event = data["event"]
clientid = data["clientid"]
print(clientid)
if (not str(clientid).startswith("farm")) and (not str(clientid).startswith("test")):
pattern = r"test"
a = re.match(pattern, clientid)
if not a:
return BaseResponse(code=500, msg="不符合畜牧clientId")
# 连接成功处理
if event == "client.connected":