修复定时任务日志和增强功能

1. 修复定时任务日志字段映射问题
   - 修正execute_time → created_at
   - 修正success_accounts → success_count
   - 修正failed_accounts → failed_count
   - 修正duration_seconds → duration
   - 位置: database.py 第1661-1686行

2. 添加定时任务调试日志
   - 显示当前检查时间和任务匹配情况
   - 帮助诊断定时任务不执行问题
   - 位置: app.py 第2869-2875行

3. 新增VIP权限对比表格
   - 在VIP信息弹窗中添加权限对比
   - 对比普通用户和VIP用户的6项权限
   - 位置: templates/index.html 第549-593行

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-12-10 16:16:45 +08:00
parent 97d1406e11
commit c22e2f6a19
3 changed files with 68 additions and 11 deletions

7
app.py
View File

@@ -2866,7 +2866,14 @@ def scheduled_task_worker():
# 获取所有启用的用户定时任务
enabled_schedules = database.get_enabled_user_schedules()
if enabled_schedules:
print(f"[定时任务检查] 当前时间: {current_time}, 星期: {current_weekday}, 找到 {len(enabled_schedules)} 个启用的定时任务")
for schedule_config in enabled_schedules:
schedule_time = schedule_config['schedule_time']
schedule_name = schedule_config.get('name', '未命名任务')
print(f"[定时任务检查] 任务 '{schedule_name}': 设定时间={schedule_time}, 当前时间={current_time}, 匹配={schedule_time == current_time}")
# 检查时间是否匹配
if schedule_config['schedule_time'] != current_time:
continue

View File

@@ -1663,7 +1663,22 @@ def get_schedule_execution_logs(schedule_id, limit=10):
with db_pool.get_db() as conn:
cursor = conn.cursor()
cursor.execute('''
SELECT * FROM schedule_execution_logs
SELECT
id,
schedule_id,
user_id,
schedule_name,
execute_time as created_at,
total_accounts,
success_accounts as success_count,
failed_accounts as failed_count,
total_items,
total_attachments,
total_screenshots,
duration_seconds as duration,
status,
error_message
FROM schedule_execution_logs
WHERE schedule_id = ?
ORDER BY execute_time DESC
LIMIT ?

View File

@@ -545,16 +545,51 @@
<div id="vipStatusText" style="font-size: 18px; font-weight: 500; margin-bottom: 8px;">VIP会员</div>
<div id="vipExpireText" style="color: var(--md-on-surface-medium);"></div>
</div>
<div style="background: #f5f5f5; border-radius: 8px; padding: 16px; margin-top: 16px;">
<div style="font-weight: 500; margin-bottom: 12px;">VIP专属特权</div>
<div style="display: grid; gap: 8px; font-size: 14px;">
<div>✅ 无限账号管理</div>
<div>✅ 自定义定时任务</div>
<div>✅ 批量启动/停止</div>
<div>✅ 详细进度显示</div>
<div>✅ 截图管理</div>
<div>✅ 优先技术支持</div>
</div>
<!-- 权限对比表格 -->
<div style="margin-top: 24px;">
<div style="font-weight: 500; margin-bottom: 12px; text-align: center;">会员权限对比</div>
<table style="width: 100%; border-collapse: collapse; font-size: 14px;">
<thead>
<tr style="background: #f5f5f5;">
<th style="padding: 12px 8px; text-align: left; border-bottom: 2px solid #ddd;">功能</th>
<th style="padding: 12px 8px; text-align: center; border-bottom: 2px solid #ddd; color: #999;">普通用户</th>
<th style="padding: 12px 8px; text-align: center; border-bottom: 2px solid #ddd; color: #FFD700;">VIP会员</th>
</tr>
</thead>
<tbody>
<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #eee;">账号管理数量</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #999;">最多5个</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #4CAF50; font-weight: 500;">✅ 无限制</td>
</tr>
<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #eee;">定时任务</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #999;">❌ 不可用</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #4CAF50; font-weight: 500;">✅ 可用</td>
</tr>
<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #eee;">批量操作</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #999;">❌ 不可用</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #4CAF50; font-weight: 500;">✅ 可用</td>
</tr>
<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #eee;">截图功能</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #999;">❌ 不可用</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #4CAF50; font-weight: 500;">✅ 可用</td>
</tr>
<tr>
<td style="padding: 10px 8px; border-bottom: 1px solid #eee;">详细进度显示</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #FFA500;">基础显示</td>
<td style="padding: 10px 8px; text-align: center; border-bottom: 1px solid #eee; color: #4CAF50; font-weight: 500;">✅ 详细显示</td>
</tr>
<tr>
<td style="padding: 10px 8px;">技术支持</td>
<td style="padding: 10px 8px; text-align: center; color: #FFA500;">标准支持</td>
<td style="padding: 10px 8px; text-align: center; color: #4CAF50; font-weight: 500;">✅ 优先支持</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">