From 7364237b276a6389f2a5c75798077b23cd82499c Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Tue, 6 Aug 2024 09:16:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=81=8A=E5=A4=A9=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E4=BA=BAtop10=20=E7=B3=BB=E5=88=97=EF=BC=8C=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E7=9B=B4=E6=8E=A5=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/api/remote_server.py | 4 ++-- pywxdump/db/dbMSG.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pywxdump/api/remote_server.py b/pywxdump/api/remote_server.py index 7c086d9..fa26592 100644 --- a/pywxdump/api/remote_server.py +++ b/pywxdump/api/remote_server.py @@ -479,14 +479,14 @@ def get_top_talker_count(): if request.method not in ["GET", "POST"]: return ReJson(1003, msg="Unsupported method") rq_data = request.json if request.method == "POST" else request.args - word = rq_data.get("wxid", "") + top = rq_data.get("top", 10) start_time = rq_data.get("start_time", 0) end_time = rq_data.get("end_time", 0) my_wxid = get_conf(g.caf, g.at, "last") if not my_wxid: return ReJson(1001, body="my_wxid is required") db_config = get_conf(g.caf, my_wxid, "db_config") - date_count = DBHandler(db_config).get_top_talker_count(top=10, start_time=start_time, end_time=end_time) + date_count = DBHandler(db_config).get_top_talker_count(top=top, start_time=start_time, end_time=end_time) return ReJson(0, date_count) diff --git a/pywxdump/db/dbMSG.py b/pywxdump/db/dbMSG.py index d1adb83..bbf8027 100644 --- a/pywxdump/db/dbMSG.py +++ b/pywxdump/db/dbMSG.py @@ -355,7 +355,7 @@ class MsgHandler(DatabaseBase): sql = ( "SELECT StrTalker, COUNT(*) AS count," "SUM(CASE WHEN IsSender = 1 THEN 1 ELSE 0 END) AS sender_count, " - "SUM(CASE WHEN IsSender = 0 THEN 1 ELSE 0 END) AS receiver_count, " + "SUM(CASE WHEN IsSender = 0 THEN 1 ELSE 0 END) AS receiver_count " "FROM MSG " "WHERE StrTalker NOT LIKE '%chatroom%' " f"{sql_time} "