利用多线程处理语音和表情包

This commit is contained in:
shuaikangzhou
2023-12-22 22:42:24 +08:00
parent e2100f9b77
commit b1a6f52148
5 changed files with 145 additions and 29 deletions

View File

@@ -154,15 +154,15 @@ class Msg:
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
from MSG
where StrTalker=? and Type=?
where StrTalker=? and Type=?
order by CreateTime
'''
try:
lock.acquire(True)
self.cursor.execute(sql, [username_, type_])
result = self.cursor.fetchall()
finally:
lock.release()
result = self.cursor.fetchall()
else:
sql = '''
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID,BytesExtra,CompressContent
@@ -610,3 +610,4 @@ if __name__ == '__main__':
msg.init_database()
print(msg.get_latest_time_of_message('wxid_0o18ef858vnu22', year_='2023'))
print(msg.get_messages_number('wxid_0o18ef858vnu22', year_='2023'))
print(msg.get_messages_by_type('wxid_0o18ef858vnu22',34))