From 2e7dc95d555cf3ee904dae96dfae6389fe07daa9 Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Wed, 10 Dec 2025 20:11:18 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20=E6=B8=85=E7=90=86=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除日志弹窗调试日志 - 移除openModal调试日志 - 移除账号API调试日志 - 移除账号加载调试日志 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app.py | 14 +------------- templates/index.html | 34 ++++------------------------------ 2 files changed, 5 insertions(+), 43 deletions(-) diff --git a/app.py b/app.py index ec78195..fb93f61 100755 --- a/app.py +++ b/app.py @@ -1030,7 +1030,6 @@ def load_user_accounts(user_id): user_accounts[user_id] = {} accounts_data = database.get_user_accounts(user_id) - print(f"[加载账号] 用户{user_id} 从数据库获取到 {len(accounts_data)} 条记录") for acc_data in accounts_data: account = Account( account_id=acc_data['id'], @@ -1041,7 +1040,6 @@ def load_user_accounts(user_id): remark=acc_data['remark'] or '' ) user_accounts[user_id][account.id] = account - print(f"[加载账号] 加载: {account.id} -> {account.username}") # ==================== Bug反馈API(用户端) ==================== @@ -1149,23 +1147,13 @@ def delete_feedback_api(feedback_id): def get_accounts(): """获取当前用户的所有账号""" user_id = current_user.id - print(f"[账号API] 请求来自用户{user_id} (类型:{type(user_id).__name__}), user_accounts keys: {list(user_accounts.keys())}") - - # 检查是否需要强制刷新(容器重启后内存数据丢失) refresh = request.args.get('refresh', 'false').lower() == 'true' # 如果user_accounts中没有数据或者请求刷新,则从数据库加载 - not_in = user_id not in user_accounts - is_empty = len(user_accounts.get(user_id, {})) == 0 - need_load = not_in or is_empty or refresh - print(f"[账号API] 检查: not_in={not_in}, empty={is_empty}, refresh={refresh}, need_load={need_load}") - - if need_load: + if user_id not in user_accounts or len(user_accounts.get(user_id, {})) == 0 or refresh: load_user_accounts(user_id) - print(f"[账号API] 加载后有 {len(user_accounts.get(user_id, {}))} 个账号") accounts = user_accounts.get(user_id, {}) - print(f"[账号API] 返回 {len(accounts)} 个账号") return jsonify([acc.to_dict() for acc in accounts.values()]) diff --git a/templates/index.html b/templates/index.html index c90dc82..961a495 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1331,45 +1331,28 @@ if (schedule) openScheduleModal(schedule); } - function viewScheduleLogs(scheduleId) { - console.log('[日志弹窗] 开始查看日志, scheduleId=', scheduleId, '(类型:', typeof scheduleId + ')'); - console.log('[日志弹窗] 当前schedules数组:', schedules); - - // 类型转换确保兼容性 + function viewScheduleLogs(scheduleId) { const numericId = parseInt(scheduleId, 10); - - const schedule = schedules.find(s => s.id == numericId); // 使用宽松相等 + const schedule = schedules.find(s => s.id == numericId); if (!schedule) { - console.error('[日志弹窗] 未找到任务, scheduleId=', scheduleId); - console.error('[日志弹窗] 可用的任务IDs:', schedules.map(s => s.id)); showToast('未找到该定时任务', 'error'); return; } - console.log('[日志弹窗] 找到任务:', schedule); document.getElementById("scheduleLogsTitle").textContent = "【" + (schedule.name || "未命名任务") + "】 执行日志"; - console.log('[日志弹窗] 开始请求API'); fetch("/api/schedules/" + numericId + "/logs?limit=20") - .then(r => { - console.log('[日志弹窗] API响应状态:', r.status); - return r.json(); - }) + .then(r => r.json()) .then(logs => { - console.log('[日志弹窗] 收到日志数据:', logs); - const container = document.getElementById("scheduleLogsList"); if (!container) { - console.error('[日志弹窗] 找不到日志容器元素 scheduleLogsList'); showToast('页面元素加载异常', 'error'); return; } if (!logs || logs.length === 0) { - console.log('[日志弹窗] 无日志,显示空状态'); container.innerHTML = "

暂无执行日志

"; } else { - console.log('[日志弹窗] 渲染', logs.length, '条日志'); let html = "
"; logs.forEach(log => { const statusClass = log.status === "success" ? "status-completed" : (log.status === "failed" ? "status-error" : "status-running"); @@ -1390,12 +1373,9 @@ container.innerHTML = html; } - console.log('[日志弹窗] 准备打开弹窗'); openModal("scheduleLogsModal"); - console.log('[日志弹窗] 弹窗已打开'); }) .catch(err => { - console.error('[日志弹窗] 请求失败:', err); showToast("加载日志失败", "error"); }); } @@ -1735,13 +1715,7 @@ // ==================== 通用函数 ==================== function openModal(id) { const element = document.getElementById(id); - console.log('[openModal] 打开弹窗:', id, '元素:', element); - if (element) { - element.classList.add('active'); - console.log('[openModal] 已添加active类, classList:', element.classList); - } else { - console.error('[openModal] 未找到元素:', id); - } + if (element) element.classList.add('active'); } function closeModal(id) { const element = document.getElementById(id);