查询操作记录数据库
This commit is contained in:
parent
c7a61e7ded
commit
78412edb44
@ -1,5 +1,5 @@
|
||||
import sqlite3
|
||||
import os
|
||||
import sqlite3
|
||||
from typing import List, Dict, Any, Optional
|
||||
|
||||
|
||||
@ -100,24 +100,24 @@ class DesignationManager(TableManager):
|
||||
return [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
|
||||
# class QueryRecordManager(TableManager):
|
||||
# def log_query(self, user_id: str, target_id: str, status: str) -> int:
|
||||
# """记录查询操作"""
|
||||
# cursor = self._execute(
|
||||
# """INSERT INTO query_record
|
||||
# (user_id, target_id, status)
|
||||
# VALUES (?, ?, ?)""",
|
||||
# (user_id, target_id, status)
|
||||
# )
|
||||
# return cursor.lastrowid
|
||||
#
|
||||
# def get_user_history(self, user_id: str) -> List[Dict[str, Any]]:
|
||||
# """获取用户查询历史"""
|
||||
# cursor = self._execute(
|
||||
# "SELECT * FROM query_record WHERE user_id = ?",
|
||||
# (user_id,)
|
||||
# )
|
||||
# return [dict(row) for row in cursor.fetchall()]
|
||||
class QueryRecordManager(TableManager):
|
||||
def log_query(self, user_id: str, ea_player_name: str, ea_player_id: str, ea_user_id: str, status: str) -> int:
|
||||
"""记录查询操作"""
|
||||
cursor = self._execute(
|
||||
"""INSERT INTO query_record
|
||||
(user_id, ea_player_name, ea_player_id, ea_user_id, status)
|
||||
VALUES (?, ?, ?, ?, ?)""",
|
||||
(user_id, ea_player_name, ea_player_id, ea_user_id, status)
|
||||
)
|
||||
return cursor.lastrowid
|
||||
|
||||
def get_user_history(self, user_id: str) -> List[Dict[str, Any]]:
|
||||
"""获取用户查询历史"""
|
||||
cursor = self._execute(
|
||||
"SELECT * FROM query_record WHERE user_id = ?",
|
||||
(user_id,)
|
||||
)
|
||||
return [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user