feat:添加评论上传功能 未完全完成

This commit is contained in:
2024-04-28 20:21:36 +08:00
parent b5c58e1216
commit c8bae04145
12 changed files with 279 additions and 42 deletions

View File

@@ -32,4 +32,24 @@ def check(username: str, password: int):
cursor = c.execute("SELECT * FROM User WHERE username = ? AND password = ?", (username, password))
if cursor.fetchone() is None:
return False
return True
return True
def getUid(username: str):
"判断用户名是否存在 并获取用户uid 用户不存在则返回None"
conn = util.getConn()
c = conn.cursor()
cursor = c.execute("SELECT * FROM User WHERE username = ?", (username,))
out = cursor.fetchone()
if out is not None:
return out[0]
return None
def getUsername(uid:str):
"判断Uid是否存在 并获取用户名 用户不存在则返回None"
conn = util.getConn()
c = conn.cursor()
cursor = c.execute("SELECT * FROM User WHERE uid = ?", (uid,))
out = cursor.fetchone()
if out is not None:
return out[1]
return None