new api feuture

This commit is contained in:
2000-Trek 2023-07-05 22:41:40 +02:00
parent 8cac75d8d5
commit a66b883995
2 changed files with 16 additions and 1 deletions

View file

@ -285,7 +285,9 @@ def api_change():
if change == None:
change = 1
c.execute(f"UPDATE users SET balance = balance + {change} WHERE id={user[0]}")
db_log.info(f"Changed the balance from user {user[0]} from {balance_old} to {user[2]}")
c.execute(f"SELECT * FROM users WHERE id = {userid}")
user_new = c.fetchall()[0]
db_log.info(f"Changed the balance from user {user[0]} from {user[2]} to {user_new[2]}")
socketio.emit("update", "update")
return make_response(json.dumps({"mode":"balance", "username":user[1], "balance":user[2]}))