update
This commit is contained in:
parent
2fe0520557
commit
e948a14409
Binary file not shown.
22
main.py
22
main.py
|
@ -15,6 +15,22 @@ def click_it(x, y):
|
|||
|
||||
|
||||
def is_black(black):
|
||||
for v in black_list:
|
||||
if dict_equal(v, black):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def dict_equal(dict1, dict2):
|
||||
if len(dict2) != len(dict1):
|
||||
return False
|
||||
for k, v1 in dict1.items():
|
||||
v2 = dict2.get(k)
|
||||
if v1 != v2:
|
||||
return False
|
||||
if k == "Point":
|
||||
if len(v1[0]) != len(v2[0]):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
|
@ -39,8 +55,7 @@ def handle_client(client_socket):
|
|||
data = data.decode("utf-8")
|
||||
data = json.loads(data)
|
||||
print(data)
|
||||
for v in black_list:
|
||||
if is_black(v):
|
||||
if is_black(data):
|
||||
print("黑名单")
|
||||
client_socket.send(b"ACK!")
|
||||
client_socket.close()
|
||||
|
@ -48,10 +63,11 @@ def handle_client(client_socket):
|
|||
Point = data["Point"]
|
||||
x = Point[0]["X"]
|
||||
y = Point[0]["Y"]
|
||||
print(x, y)
|
||||
click_it(x, y)
|
||||
except Exception as e:
|
||||
pass
|
||||
client_socket.send(b"ACK!")
|
||||
client_socket.close()
|
||||
|
||||
|
||||
# 等待连接,这里必定进入循环
|
||||
|
|
Loading…
Reference in New Issue