尝试修复挑战系统中的用户名错误
This commit is contained in:
@@ -202,6 +202,18 @@ class WPSConfigAPI(WPSAPI):
|
||||
value = record.get("username")
|
||||
return str(value) if value else f"user_{user_id}"
|
||||
|
||||
def find_user_id_by_username(self, username: str) -> Optional[int]:
|
||||
text = (username or "").strip()
|
||||
if not text:
|
||||
return None
|
||||
cursor = get_db().conn.cursor()
|
||||
cursor.execute(
|
||||
"SELECT user_id FROM user_info WHERE username = ? COLLATE NOCASE",
|
||||
(text,),
|
||||
)
|
||||
row = cursor.fetchone()
|
||||
return int(row["user_id"]) if row else None
|
||||
|
||||
def get_user_url(self, user_id: int) -> Optional[str]:
|
||||
record = self._get_user_record(user_id)
|
||||
if not record:
|
||||
|
||||
Reference in New Issue
Block a user