聊天记录从后往前显示

This commit is contained in:
shuaikangzhou
2023-11-18 11:51:58 +08:00
parent fd8d0ed153
commit c72b67f2a0
6 changed files with 70 additions and 52 deletions

View File

@@ -1,7 +1,8 @@
import os.path
import sqlite3
import time
import threading
lock = threading.Lock()
DB = None
cursor = None
micromsg_path = "./app/Database/Msg/MicroMsg.db"
@@ -27,6 +28,7 @@ def is_database_exist():
def get_contact():
try:
lock.acquire(True)
sql = '''select UserName,Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl.bigHeadImgUrl
from Contact inner join ContactHeadImgUrl on Contact.UserName = ContactHeadImgUrl.usrName
where Type=3 and Alias is not null
@@ -34,15 +36,8 @@ def get_contact():
'''
cursor.execute(sql)
result = cursor.fetchall()
except:
time.sleep(0.2)
sql = '''select UserName,Alias,Type,Remark,NickName,PYInitial,RemarkPYInitial,ContactHeadImgUrl.smallHeadImgUrl,ContactHeadImgUrl.bigHeadImgUrl
from Contact inner join ContactHeadImgUrl on Contact.UserName = ContactHeadImgUrl.usrName
where Type=3 and Alias is not null
order by PYInitial
'''
cursor.execute(sql)
result = cursor.fetchall()
finally:
lock.release()
# DB.commit()
return result