修复bug和清理调试代码
1. email_service.py: 删除未定义的log_email_send调用(send_email内部已记录日志) 2. app.py: 删除[DEBUG run_task]调试打印语句 3. playwright_automation.py: 删除[调试]诊断日志块 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
3
app.py
3
app.py
@@ -1952,8 +1952,7 @@ def run_task(user_id, account_id, browse_type, enable_screenshot=True, source="m
|
|||||||
retry_count: 当前重试次数,用于自动重试机制(最多重试2次)
|
retry_count: 当前重试次数,用于自动重试机制(最多重试2次)
|
||||||
"""
|
"""
|
||||||
MAX_AUTO_RETRY = 2 # 最大自动重试次数
|
MAX_AUTO_RETRY = 2 # 最大自动重试次数
|
||||||
print(f"[DEBUG run_task] account={account_id}, enable_screenshot={enable_screenshot} (类型:{type(enable_screenshot).__name__}), source={source}, retry={retry_count}")
|
|
||||||
|
|
||||||
if user_id not in user_accounts or account_id not in user_accounts[user_id]:
|
if user_id not in user_accounts or account_id not in user_accounts[user_id]:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -2112,22 +2112,8 @@ def send_batch_task_complete_email(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if result['success']:
|
if result['success']:
|
||||||
# 记录发送日志
|
|
||||||
log_email_send(
|
|
||||||
email_type='batch_task_complete',
|
|
||||||
to_email=email,
|
|
||||||
subject=f'定时任务完成 - {schedule_name}',
|
|
||||||
success=True
|
|
||||||
)
|
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
else:
|
else:
|
||||||
log_email_send(
|
|
||||||
email_type='batch_task_complete',
|
|
||||||
to_email=email,
|
|
||||||
subject=f'定时任务完成 - {schedule_name}',
|
|
||||||
success=False,
|
|
||||||
error=result.get('error', '')
|
|
||||||
)
|
|
||||||
return {'success': False, 'error': result.get('error', '发送失败')}
|
return {'success': False, 'error': result.get('error', '发送失败')}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -802,20 +802,6 @@ class PlaywrightAutomation:
|
|||||||
|
|
||||||
if rows_count == 0:
|
if rows_count == 0:
|
||||||
self.log("当前页面没有内容")
|
self.log("当前页面没有内容")
|
||||||
# 调试:输出页面信息帮助诊断
|
|
||||||
try:
|
|
||||||
page_html = self.page.content()
|
|
||||||
if 'ltable' in page_html:
|
|
||||||
self.log(f"[调试] 表格存在,但没有数据行")
|
|
||||||
# 检查是否有"暂无记录"提示
|
|
||||||
if '暂无' in page_html or '没有' in page_html:
|
|
||||||
self.log(f"[调试] 页面显示暂无记录")
|
|
||||||
else:
|
|
||||||
self.log(f"[调试] 页面中没有找到ltable表格")
|
|
||||||
# 检查URL
|
|
||||||
self.log(f"[调试] iframe URL: {self.page.url}")
|
|
||||||
except Exception as debug_e:
|
|
||||||
self.log(f"[调试] 获取页面信息失败: {str(debug_e)[:50]}")
|
|
||||||
empty_page_counter += 1
|
empty_page_counter += 1
|
||||||
self.log(f"连续空页面数: {empty_page_counter}")
|
self.log(f"连续空页面数: {empty_page_counter}")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user