feat: SMTP配额自动重置(北京时间凌晨0点)

- 添加reset_smtp_daily_quota函数主动重置配额
- 添加定时任务在北京时间00:00自动重置SMTP配额
- 保留被动重置作为备份机制

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-13 04:01:50 +08:00
parent a7976bcdfc
commit 9e761140c1
2 changed files with 22 additions and 0 deletions

5
app.py
View File

@@ -4017,10 +4017,15 @@ def scheduled_task_worker():
# 每小时清理过期验证码
schedule.every().hour.do(cleanup_expired_captcha)
# 每天北京时间0点重置SMTP配额
quota_reset_utc_time = cst_to_utc_time("00:00")
schedule.every().day.at(quota_reset_utc_time).do(email_service.reset_smtp_daily_quota)
# 只在首次运行时打印基础任务日志
if is_first_run:
print(f"[定时任务] 已设置数据清理任务: 每天 CST 03:00 (UTC {cleanup_utc_time})")
print(f"[定时任务] 已设置验证码清理任务: 每小时执行一次")
print(f"[定时任务] 已设置SMTP配额重置: 每天 CST 00:00 (UTC {quota_reset_utc_time})")
# 如果启用了定时浏览任务,则添加
if config.get('schedule_enabled'):