bug fix i think
This commit is contained in:
parent
2449d0955b
commit
f1dfc5668b
@ -291,8 +291,8 @@ async def minus_user_points(conn: connection, user_id: str, bet_value: int):
|
|||||||
cur.execute(
|
cur.execute(
|
||||||
"UPDATE member "
|
"UPDATE member "
|
||||||
"SET points = points - %s "
|
"SET points = points - %s "
|
||||||
"WHERE user_id=%s",
|
"WHERE user_id = %s AND points - %s >= 50",
|
||||||
(bet_value, user_id)
|
(bet_value, user_id, bet_value)
|
||||||
)
|
)
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
@ -35,7 +35,7 @@ CREATE TABLE member
|
|||||||
user_id VARCHAR(255),
|
user_id VARCHAR(255),
|
||||||
guild_id VARCHAR(255),
|
guild_id VARCHAR(255),
|
||||||
username VARCHAR(255),
|
username VARCHAR(255),
|
||||||
points bigint DEFAULT 50 NOT NULL CHECK (points >= 50),
|
points bigint DEFAULT 50,
|
||||||
bet_value bigint DEFAULT 50,
|
bet_value bigint DEFAULT 50,
|
||||||
PRIMARY KEY (user_id),
|
PRIMARY KEY (user_id),
|
||||||
FOREIGN KEY (guild_id) REFERENCES guild (guild_id)
|
FOREIGN KEY (guild_id) REFERENCES guild (guild_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user