1 parent
0ff56fe695
commit
da7072b2c3
3 files changed
+18
-4
No files matched your search
@@ -247,17 +247,23 @@ class ParsingMSG(DatabaseBase):
|
||||
"room_name": StrTalker, "content": content, "CreateTime": CreateTime, "id": id}
|
||||
return row_data
|
||||
|
||||
def msg_list(self, wxid="", start_index=0, page_size=500):
|
||||
def msg_list(self, wxid="", start_index=0, page_size=500, msg_type: str = ""):
|
||||
if wxid:
|
||||
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 WHERE StrTalker=? "
|
||||
"ORDER BY CreateTime ASC LIMIT ?,?")
|
||||
if msg_type:
|
||||
sql = sql.replace("ORDER BY CreateTime ASC LIMIT ?,?",
|
||||
f"AND Type={msg_type} ORDER BY CreateTime ASC LIMIT ?,?")
|
||||
result1 = self.execute_sql(sql, (wxid, 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 ?,?")
|
||||
if msg_type:
|
||||
sql = sql.replace("ORDER BY CreateTime ASC LIMIT ?,?",
|
||||
f"AND Type={msg_type} ORDER BY CreateTime ASC LIMIT ?,?")
|
||||
result1 = self.execute_sql(sql, (start_index, page_size))
|
||||
if not result1:
|
||||
return [], []
|
||||
|
||||
@@ -72,7 +72,7 @@ class ParsingMicroMsg(DatabaseBase):
|
||||
def user_list(self, word=None):
|
||||
"""
|
||||
获取联系人列表
|
||||
:param MicroMsg_db_path: MicroMsg.db 文件路径
|
||||
:param word 查询关键字,可以是用户名、昵称、备注、描述,允许拼音
|
||||
:return: 联系人列表
|
||||
"""
|
||||
users = []
|
||||
@@ -87,6 +87,8 @@ class ParsingMicroMsg(DatabaseBase):
|
||||
f"OR A.NickName LIKE '%{word}%' "
|
||||
f"OR A.Remark LIKE '%{word}%' "
|
||||
f"OR A.Alias LIKE '%{word}%' "
|
||||
f"OR A.QuanPin LIKE LOWER('%{word}%') "
|
||||
f"OR LOWER(A.PYInitial) LIKE LOWER('%{word}%') "
|
||||
# f"OR A.Reserved6 LIKE '%{word}%' "
|
||||
"ORDER BY A.NickName DESC;")
|
||||
result = self.execute_sql(sql)
|
||||
|
||||
Reference in new issue
Block a user