获取contact_count_list增加去重功能

This commit is contained in:
xaoyaoo 2024-01-09 17:37:38 +08:00
parent 6d502dbc04
commit 86d3a957cf
3 changed files with 4 additions and 4 deletions

View File

@ -137,9 +137,7 @@ qq交流群577704006左边二维码 or 点击链接加入群聊[pywxdum
# 四、致谢
[![PyWxDump 贡献者](https://contrib.rocks/image?repo=xaoyaoo/PyWxDump)](https://github.com/xaoyaoo/PyWxDump/graphs/contributors)
[![UI 贡献者](https://contrib.rocks/image?repo=xaoyaoo/wxdump_web)](https://github.com/xaoyaoo/wxdump_web/graphs/contributors)
[![PyWxDump 贡献者](https://contrib.rocks/image?repo=xaoyaoo/PyWxDump)](https://github.com/xaoyaoo/PyWxDump/graphs/contributors)[![UI 贡献者](https://contrib.rocks/image?repo=xaoyaoo/wxdump_web)](https://github.com/xaoyaoo/wxdump_web/graphs/contributors)
# 五、许可证

View File

@ -99,6 +99,8 @@ def contact_count_list():
chat_count = analyzer.get_chat_count(msg_path)
for contact in contact_list:
contact["chat_count"] = chat_count.get(contact["username"], 0)
# 去重
contact_list = [dict(t) for t in {tuple(d.items()) for d in contact_list}]
# 降序
contact_list = sorted(contact_list, key=lambda x: x["chat_count"], reverse=True)

View File

@ -1,7 +1,7 @@
import logging
def ReJson(code: int, body: dict = None, msg: str = None, error: str = None, extra: dict = None) -> dict:
def ReJson(code: int, body: [dict, list] = None, msg: str = None, error: str = None, extra: dict = None) -> dict:
"""
返回格式化的json数据
:param code: 状态码 int