OpenIM* 增加 #86

This commit is contained in:
xaoyaoo 2024-03-22 18:13:36 +08:00
parent ea8d15ff8c
commit 4072a094f0
2 changed files with 20 additions and 7 deletions

View File

@ -47,7 +47,7 @@ def get_contact(MicroMsg_db_path, wx_id):
"describe": result[4], "headImgUrl": result[5]}
def get_contact_list(MicroMsg_db_path):
def get_contact_list(MicroMsg_db_path, OpenIMContact_db_path=None):
"""
获取联系人列表
:param MicroMsg_db_path: MicroMsg.db 文件路径
@ -67,9 +67,20 @@ def get_contact_list(MicroMsg_db_path):
users.append(
{"username": username, "nickname": nickname, "remark": remark, "account": Alias, "describe": describe,
"headImgUrl": headImgUrl})
# return users
if OpenIMContact_db_path:
with DBPool(OpenIMContact_db_path) as db:
sql = ("SELECT A.UserName, A.NickName, A.Remark,A.BigHeadImgUrl FROM OpenIMContact A "
"ORDER BY NickName ASC;")
result = execute_sql(db, sql)
for row in result:
# 获取用户名、昵称、备注和聊天记录数量
username, nickname, remark, headImgUrl = row
users.append(
{"username": username, "nickname": nickname, "remark": remark, "account": "", "describe": "",
"headImgUrl": headImgUrl})
return users
def get_chatroom_list(MicroMsg_db_path):
"""
获取群聊列表
@ -305,7 +316,6 @@ def get_all_chat_count(MSG_db_path: [str, list]):
return 0
def export_csv(username, outpath, MSG_ALL_db_path, page_size=5000):
if not os.path.exists(outpath):
outpath = os.path.join(os.getcwd(), "export" + os.sep + username)

View File

@ -263,6 +263,9 @@ def func_get_msgs(start, limit, wxid, msg_path, micro_path):
msg_list = analyzer.get_msg_list(msg_path, wxid, start_index=start, page_size=limit)
# row_data = {"MsgSvrID": MsgSvrID, "type_name": type_name, "is_sender": IsSender, "talker": talker,
# "room_name": StrTalker, "content": content, "CreateTime": CreateTime}
if "merge_all" in micro_path:
contact_list = analyzer.get_contact_list(micro_path,micro_path)
else:
contact_list = analyzer.get_contact_list(micro_path)
userlist = {}