🧹 清理调试日志
- 移除日志弹窗调试日志 - 移除openModal调试日志 - 移除账号API调试日志 - 移除账号加载调试日志 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
14
app.py
14
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()])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user