api return fix
This commit is contained in:
parent
880dce48f7
commit
5a954ecdae
1 changed files with 5 additions and 5 deletions
10
main.py
10
main.py
|
@ -261,21 +261,21 @@ def get_id():
|
||||||
finished = queue_item
|
finished = queue_item
|
||||||
return make_response(json.dumps({"mode":"0","error":"170"}))
|
return make_response(json.dumps({"mode":"0","error":"170"}))
|
||||||
else:
|
else:
|
||||||
c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, {user})")
|
c.execute(f"INSERT OR IGNORE INTO tags (tagid, userid) VALUES ({tag_id}, {user[1]})")
|
||||||
message = tag_id
|
message = tag_id
|
||||||
finished = queue_item
|
finished = queue_item
|
||||||
c.execute(f"SELECT * FROM users WHERE id={user}")
|
c.execute(f"SELECT * FROM users WHERE id={user[1]}")
|
||||||
username = c.fetchall()
|
username = c.fetchall()
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return make_response(json.dumps({"mode":"2","username":username,"code":"1"}))
|
return make_response(json.dumps({"mode":"2","username":username,"code":"1"}))
|
||||||
elif state == "remove":
|
elif state == "remove":
|
||||||
c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user})")
|
c.execute(f"SELECT * FROM tags WHERE (tagid = {tag_id} AND userid = {user[1]})")
|
||||||
tags = c.fetchall()
|
tags = c.fetchall()
|
||||||
if tags != []:
|
if tags != []:
|
||||||
c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = {user}) ")
|
c.execute(f"DELETE FROM tags WHERE (tagid = {tag_id} AND userid = {user[1]}) ")
|
||||||
message = tag_id
|
message = tag_id
|
||||||
finished = queue_item
|
finished = queue_item
|
||||||
c.execute(f"SELECT * FROM users WHERE id={user}")
|
c.execute(f"SELECT * FROM users WHERE id={user[1]}")
|
||||||
username = c.fetchall()
|
username = c.fetchall()
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return make_response(json({"mode":"2","username":username,"code":"2"}))
|
return make_response(json({"mode":"2","username":username,"code":"2"}))
|
||||||
|
|
Loading…
Reference in a new issue