fix(ops): 降低 SQL/请求日志噪声并改善 500 恢复

SQL 回显与 DEBUG 解耦;API 请求日志按字节截断并失败降级;可恢复初始化错误不永久锁死,500 页可重试;修复生产任务 in_ 多余 subquery;补充本地登录态清理页。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cykjandCursor committed 2026-12-01 17:58:49 +08:00
1 parent d7611a1bd6
commit f50c55f7b6
8 files changed
+112 -12

No files matched your search

+20 -3
View File
@@ -368,8 +368,6 @@ async function handleDynamicRoutes(
return
}
// 标记初始化失败,防止死循环
routeInitFailed = true
routeInitInProgress = false
// 输出详细错误信息,便于排查
@@ -377,7 +375,14 @@ async function handleDynamicRoutes(
console.error(`[RouteGuard] 错误码: ${error.code}, 消息: ${error.message}`)
}
// 跳转到 500 页面,使用 replace 避免产生历史记录
// 后端短暂不可达/超时:展示 500,但不永久锁定,便于服务恢复后点「返回首页」重试
if (isRecoverableInitError(error)) {
next({ name: 'Exception500', replace: true })
return
}
// 其它初始化失败:标记失败,防止死循环(刷新页面或重新登录可重置)
routeInitFailed = true
next({ name: 'Exception500', replace: true })
}
}
@@ -448,3 +453,15 @@ function handleRootPathRedirect(to: RouteLocationNormalized, next: NavigationGua
function isUnauthorizedError(error: unknown): boolean {
return isHttpError(error) && error.code === ApiStatus.unauthorized
}
/** 后端暂不可达类错误:允许用户在服务恢复后重试初始化 */
function isRecoverableInitError(error: unknown): boolean {
if (!isHttpError(error)) return false
return (
error.code === ApiStatus.networkError ||
error.code === ApiStatus.requestTimeout ||
error.code === ApiStatus.badGateway ||
error.code === ApiStatus.serviceUnavailable ||
error.code === ApiStatus.gatewayTimeout
)
}