fix table name

This commit is contained in:
BennyThink 2022-02-04 15:53:36 +08:00
parent a2f29df98c
commit 43e8a9ecf4
No known key found for this signature in database
GPG key ID: 6CD0DBDA5235D481
2 changed files with 4 additions and 4 deletions

View file

@ -84,7 +84,7 @@ class Redis:
def show_usage(self):
from downloader import sizeof_fmt
db = MySQL()
db.cur.execute("select * from VIP")
db.cur.execute("select * from vip")
data = db.cur.fetchall()
fd = []
for item in data:

View file

@ -39,14 +39,14 @@ def get_username(chat_id):
class VIP(Redis, MySQL):
def check_vip(self, user_id: "int") -> "tuple":
self.cur.execute("SELECT * FROM VIP WHERE user_id=%s", (user_id,))
self.cur.execute("SELECT * FROM vip WHERE user_id=%s", (user_id,))
data = self.cur.fetchone()
return data
def add_vip(self, user_data: "dict") -> ("bool", "str"):
sql = "INSERT INTO VIP VALUES (%s,%s,%s,%s,%s,%s);"
sql = "INSERT INTO vip VALUES (%s,%s,%s,%s,%s,%s);"
# first select
self.cur.execute("SELECT * FROM VIP WHERE payment_id=%s", (user_data["payment_id"],))
self.cur.execute("SELECT * FROM vip WHERE payment_id=%s", (user_data["payment_id"],))
is_exist = self.cur.fetchone()
if is_exist:
return "Failed. {} is being used by user {}".format(user_data["payment_id"], is_exist[0])