add calender_chart analysis

This commit is contained in:
DzhiWang
2023-12-07 16:51:15 +08:00
parent 2efc52840a
commit 3a3baa5f8c
2 changed files with 56 additions and 2 deletions

View File

@@ -170,6 +170,21 @@ class Msg:
return res
def get_messages_by_days(self, username_, year_='2023'):
sql = '''
SELECT strftime('%Y-%m-%d',CreateTime,'unixepoch','localtime') as days,count(MsgSvrID)
from MSG
where StrTalker = ? and strftime('%Y',CreateTime,'unixepoch','localtime') = ?
group by days
'''
try:
lock.acquire(True)
self.cursor.execute(sql, [username_, year_])
result = self.cursor.fetchall()
finally:
lock.release()
return result
def get_first_time_of_message(self, username_):
if not self.open_flag:
return None