From 20efb7ec2a8f5e60ea82418262b8fe841cc15f6a Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Thu, 11 Dec 2025 22:22:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=AC=AC=E5=85=AD=E9=98=B6=E6=AE=B5=20-=20AP?= =?UTF-8?q?I=E6=B5=8F=E8=A7=88=E4=BB=BB=E5=8A=A1=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在API模式浏览任务完成时(不截图的情况下),也发送任务完成邮件通知 修改位置: app.py run_browse_task函数 - 在enable_screenshot=False时,浏览成功后发送邮件通知 - 复用email_service.send_task_complete_email_async() 至此邮件功能六个阶段全部完成: 1. 邮件基础设施(多SMTP配置、故障转移) 2. 注册邮箱验证 3. 密码重置邮件 4. 任务完成通知(带截图) 5. 用户邮箱绑定 6. API浏览任务通知 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/app.py b/app.py index 8e2bae7..6ec21dc 100755 --- a/app.py +++ b/app.py @@ -2166,6 +2166,24 @@ def run_task(user_id, account_id, browse_type, enable_screenshot=True, source="m duration=int(time_module.time() - task_start_time), source=source ) + # 发送任务完成邮件通知(不截图时在此发送) + try: + user_info = database.get_user_by_id(user_id) + if user_info and user_info.get('email'): + account_name = account.remark if account.remark else account.username + email_service.send_task_complete_email_async( + user_id=user_id, + email=user_info['email'], + username=user_info['username'], + account_name=account_name, + browse_type=browse_type, + total_items=result.total_items, + total_attachments=result.total_attachments, + screenshot_path=None, + log_callback=lambda msg: log_to_client(msg, user_id, account_id) + ) + except Exception as email_error: + logger.warning(f"发送任务完成邮件失败: {email_error}") # 成功则跳出重试循环 break else: