デバイスリストが空の場合の処理を追加
This commit is contained in:
parent
43519b104d
commit
e65f6024d3
1 changed files with 28 additions and 21 deletions
|
@ -66,34 +66,41 @@ class Auth():
|
||||||
pc_uuid = str(kwargs["pc_uuid"])
|
pc_uuid = str(kwargs["pc_uuid"])
|
||||||
pc_token = str(kwargs["pc_token"])
|
pc_token = str(kwargs["pc_token"])
|
||||||
if "device_list" in kwargs:
|
if "device_list" in kwargs:
|
||||||
device_list = kwargs["device_list"]
|
if kwargs["device_list"] == []:
|
||||||
|
device_list = None
|
||||||
|
else:
|
||||||
|
device_list = kwargs["device_list"]
|
||||||
else:
|
else:
|
||||||
pass
|
device_list = None
|
||||||
keyboard_number = "own"
|
|
||||||
mouse_number = "own"
|
keyboard_number = 0
|
||||||
|
mouse_number = 0
|
||||||
|
|
||||||
if "password_hash" in kwargs:
|
if "password_hash" in kwargs:
|
||||||
password_hash = str(kwargs["password_hash"])
|
password_hash = str(kwargs["password_hash"])
|
||||||
cursor.execute("SELECT * FROM pc_list WHERE pc_number = %s AND password_hash = %s AND pc_uuid = %s AND pc_token = %s", (pc_number, password_hash, pc_uuid, pc_token))
|
cursor.execute("SELECT * FROM pc_list WHERE pc_number = %s AND password_hash = %s AND pc_uuid = %s AND pc_token = %s", (pc_number, password_hash, pc_uuid, pc_token))
|
||||||
pc_info = cursor.fetchall()
|
pc_info = cursor.fetchall()
|
||||||
if pc_info:
|
if pc_info:
|
||||||
for device in device_list:
|
if device_list == None:
|
||||||
cursor.execute("SELECT * FROM keyboard_list WHERE device_instance_path = %s", (device["device_instance_path"],))
|
pass
|
||||||
keyboard_record = cursor.fetchall()
|
else:
|
||||||
if keyboard_record:
|
for device in device_list:
|
||||||
keyboard_number = int(keyboard_record[0][0])
|
cursor.execute("SELECT * FROM keyboard_list WHERE device_instance_path = %s", (device["device_instance_path"],))
|
||||||
break
|
keyboard_record = cursor.fetchall()
|
||||||
else:
|
if keyboard_record:
|
||||||
pass
|
keyboard_number = int(keyboard_record[0][0])
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
for device in device_list:
|
for device in device_list:
|
||||||
cursor.execute("SELECT * FROM mouse_list WHERE device_instance_path = %s", (device["device_instance_path"],))
|
cursor.execute("SELECT * FROM mouse_list WHERE device_instance_path = %s", (device["device_instance_path"],))
|
||||||
mouse_record = cursor.fetchall()
|
mouse_record = cursor.fetchall()
|
||||||
if mouse_record:
|
if mouse_record:
|
||||||
mouse_number = int(mouse_record[0][0])
|
mouse_number = int(mouse_record[0][0])
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return {"result": 0, "about": "ok", "output_dict": {"keyboard_number": keyboard_number, "mouse_number": mouse_number}}
|
return {"result": 0, "about": "ok", "output_dict": {"keyboard_number": keyboard_number, "mouse_number": mouse_number}}
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue