调整主题和提取时间,更新最新时间
This commit is contained in:
@@ -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小时的消息
|
||||
|
||||
Reference in New Issue
Block a user