get_session_list 根据时间排序更加合理

This commit is contained in:
xaoyaoo 2024-08-03 18:17:25 +08:00
parent 3f9894cde1
commit 42a90a9ecf

View File

@ -31,6 +31,7 @@ class MicroHandler(DatabaseBase):
# 为 Session 表添加索引 # 为 Session 表添加索引
self.execute("CREATE INDEX IF NOT EXISTS idx_Session_strUsrName_nTime ON Session(strUsrName, nTime);") self.execute("CREATE INDEX IF NOT EXISTS idx_Session_strUsrName_nTime ON Session(strUsrName, nTime);")
self.execute("CREATE INDEX IF NOT EXISTS idx_Session_nOrder ON Session(nOrder);") self.execute("CREATE INDEX IF NOT EXISTS idx_Session_nOrder ON Session(nOrder);")
self.execute("CREATE INDEX IF NOT EXISTS idx_Session_nTime ON Session(nTime);")
# 为 Contact 表添加索引 # 为 Contact 表添加索引
self.execute("CREATE INDEX IF NOT EXISTS idx_Contact_UserName ON Contact(UserName);") self.execute("CREATE INDEX IF NOT EXISTS idx_Contact_UserName ON Contact(UserName);")
@ -85,7 +86,7 @@ class MicroHandler(DatabaseBase):
"left join Contact C ON C.UserName = S.strUsrName " "left join Contact C ON C.UserName = S.strUsrName "
"LEFT JOIN ContactHeadImgUrl H ON C.UserName = H.usrName " "LEFT JOIN ContactHeadImgUrl H ON C.UserName = H.usrName "
"WHERE S.strUsrName!='@publicUser' " "WHERE S.strUsrName!='@publicUser' "
"ORDER BY S.nOrder DESC;" "ORDER BY S.nTime DESC;"
) )
ret = self.execute(sql) ret = self.execute(sql)
if not ret: if not ret: