たのむ
This commit is contained in:
parent
18076cdf31
commit
a6082c1f0a
1 changed files with 17 additions and 23 deletions
12
dislocker.py
12
dislocker.py
|
@ -30,7 +30,7 @@ class Bot(discord.Client):
|
|||
#パスワード生成、ハッシュ化
|
||||
password = self.password_generate(4)
|
||||
password_hash = self.hash_genarate(password)
|
||||
print("パスワード生成完了")
|
||||
print("password generated")
|
||||
#メンバーリストと送信者を照合
|
||||
cursor = self.db.cursor()
|
||||
cursor.execute("SELECT * FROM club_member WHERE discord_userid = %s", (discord_user_id,))
|
||||
|
@ -40,11 +40,11 @@ class Bot(discord.Client):
|
|||
result = {"result": "user_data_not_found"}
|
||||
#ユーザーデータが見つかった場合(登録済みの場合)
|
||||
else:
|
||||
print("ユーザーデータが見つかった")
|
||||
print("found user data")
|
||||
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id=%s ORDER BY id DESC LIMIT 1", (user_record[0][0],))
|
||||
pc_usage_history_record = cursor.fetchall()
|
||||
if pc_usage_history_record:
|
||||
print("使用したことがあります")
|
||||
print("used")
|
||||
if pc_usage_history_record[0][5] == None:
|
||||
result = {"result": "pc_already_in_use_by_you", "pc_number": str(pc_usage_history_record[0][2]), "device_number": str(pc_usage_history_record[0][3]), "start_time": str(pc_usage_history_record[0][4]), "detail": str(pc_usage_history_record[0][6])}
|
||||
else:
|
||||
|
@ -63,12 +63,6 @@ class Bot(discord.Client):
|
|||
cursor.execute("UPDATE pc_list SET password_hash = %s WHERE pc_number = %s", (password_hash, pc_number))
|
||||
self.db.commit()
|
||||
result = {"result": "ok", "password": str(password), "name": str(user_record[0][1])}
|
||||
else:
|
||||
cursor.execute("SELECT * FROM pc_usage_history WHERE member_id=%s ORDER BY id DESC LIMIT 1", (user_record[0][0],))
|
||||
pc_usage_history_record = cursor.fetchall()
|
||||
if pc_usage_history_record:
|
||||
if pc_usage_history_record[0][5] == None:
|
||||
result = {"result": "pc_already_in_use_by_you", "pc_number": str(pc_usage_history_record[0][2]), "device_number": str(pc_usage_history_record[0][3]), "start_time": str(pc_usage_history_record[0][4]), "detail": str(pc_usage_history_record[0][6])}
|
||||
else:
|
||||
cursor.execute("SELECT * FROM pc_list WHERE pc_number=%s", (pc_number,))
|
||||
pc_list_record = cursor.fetchall()
|
||||
|
|
Loading…
Reference in a new issue