定时任务,周计算调整。
This commit is contained in:
@@ -395,8 +395,8 @@ class MessagePushTask(MessagePluginInterface):
|
||||
# 如果本周没有下一个执行日,取下周的第一个执行日
|
||||
if next_weekday is None:
|
||||
next_weekday = weekly_days[0]
|
||||
# 计算到下周第一个执行日的天数
|
||||
days_ahead = 7 - current_weekday + next_weekday
|
||||
# 直接计算到下周的指定日期
|
||||
days_ahead = (7 - current_weekday) + next_weekday
|
||||
else:
|
||||
days_ahead = next_weekday - current_weekday
|
||||
|
||||
@@ -407,6 +407,8 @@ class MessagePushTask(MessagePluginInterface):
|
||||
if next_time <= now:
|
||||
next_time = next_time + timedelta(days=7)
|
||||
|
||||
self.LOG.info(f"每周任务计算:当前周几={current_weekday}, 下次执行周几={next_weekday}, 天数差={days_ahead}, 下次执行时间={next_time}")
|
||||
|
||||
except (json.JSONDecodeError, ValueError, IndexError) as e:
|
||||
self.LOG.error(f"处理每周执行日失败: {e}")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user