This commit is contained in:
xaoyaoo 2024-03-15 15:45:59 +08:00
parent 6017246491
commit e0b70ddc39

View File

@ -306,6 +306,7 @@ def get_chat_count(MSG_db_path: [str, list], username: str = ""):
for row in result: for row in result:
username, chat_count = row username, chat_count = row
chat_counts[username] = chat_count chat_counts[username] = chat_count
db1.close()
return chat_counts return chat_counts
@ -318,8 +319,12 @@ def get_all_chat_count(MSG_db_path: [str, list]):
sql = f"SELECT COUNT(*) FROM MSG;" sql = f"SELECT COUNT(*) FROM MSG;"
db1 = sqlite3.connect(MSG_db_path) db1 = sqlite3.connect(MSG_db_path)
result = execute_sql(db1, sql) result = execute_sql(db1, sql)
chat_counts = result[0][0] if result and len(result) > 0:
return chat_counts chat_counts = result[0][0]
db1.close()
return chat_counts
db1.close()
return 0
def export_csv(username, outpath, MSG_ALL_db_path, page_size=5000): def export_csv(username, outpath, MSG_ALL_db_path, page_size=5000):