OpenIM* 增加 #86
This commit is contained in:
parent
ea8d15ff8c
commit
4072a094f0
@ -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,8 +67,19 @@ def get_contact_list(MicroMsg_db_path):
|
||||
users.append(
|
||||
{"username": username, "nickname": nickname, "remark": remark, "account": Alias, "describe": describe,
|
||||
"headImgUrl": headImgUrl})
|
||||
return users
|
||||
|
||||
# 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):
|
||||
"""
|
||||
@ -148,12 +159,12 @@ def get_msg_list(MSG_db_path, selected_talker="", start_index=0, page_size=500):
|
||||
"SELECT localId, IsSender, StrContent, StrTalker, Sequence, Type, SubType,CreateTime,MsgSvrID,DisplayContent,CompressContent,BytesExtra,ROW_NUMBER() OVER (ORDER BY CreateTime ASC) AS id "
|
||||
"FROM MSG WHERE StrTalker=? "
|
||||
"ORDER BY CreateTime ASC LIMIT ?,?")
|
||||
result1 = execute_sql(db1,sql, (selected_talker, start_index, page_size))
|
||||
result1 = execute_sql(db1, sql, (selected_talker, start_index, page_size))
|
||||
else:
|
||||
sql = (
|
||||
"SELECT localId, IsSender, StrContent, StrTalker, Sequence, Type, SubType,CreateTime,MsgSvrID,DisplayContent,CompressContent,BytesExtra,ROW_NUMBER() OVER (ORDER BY CreateTime ASC) AS id "
|
||||
"FROM MSG ORDER BY CreateTime ASC LIMIT ?,?")
|
||||
result1 = execute_sql(db1,sql, (start_index, page_size))
|
||||
result1 = execute_sql(db1, sql, (start_index, page_size))
|
||||
|
||||
data = []
|
||||
for row in result1:
|
||||
@ -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)
|
||||
|
@ -263,7 +263,10 @@ 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}
|
||||
contact_list = analyzer.get_contact_list(micro_path)
|
||||
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 = {}
|
||||
my_wxid = read_session(g.sf, "my_wxid")
|
||||
|
Loading…
Reference in New Issue
Block a user