调整主题和提取时间,更新最新时间

This commit is contained in:
Liu
2025-02-15 19:38:32 +08:00
parent 4d1811ce23
commit f59b86051b
2 changed files with 4 additions and 5 deletions

View File

@@ -49,16 +49,15 @@ def get_messages(group_id, all_contacts: dict):
# 生成Redis key
key = f"{group_id}:summary_time"
last_summary_time = r.get(key)
current_time = datetime.now()
current_date = current_time.strftime('%Y-%m-%d %H:%M:%S')
if last_summary_time is None:
# 获取当前时间并计算8小时前的时间
current_time = datetime.now()
eight_hours_ago = current_time - timedelta(hours=8)
# 转换为数据库中存储的时间格式 (假设timestamp是DATETIME类型)
last_summary_time = eight_hours_ago.strftime('%Y-%m-%d %H:%M:%S')
current_date = current_time.strftime('%Y-%m-%d %H:%M:%S')
r.set(key, current_date)
r.set(key, current_date)
with connection.cursor() as cursor:
# 执行查询获取最近8小时的消息