日志管理增强:登录补全角色、IP兜底、记录业务对象与决策

- 登录日志从用户表补全 actorId/actorName/role
- IP 兜底:X-Forwarded-For/X-Real-IP → 否则用连接信息(getConnInfo)
- 业务动作记录目标项目名(target_name)与决策(风控审核·通过/管理层审批·驳回/红线裁定·命中)
- system_logs 增加 target_name 列;前端日志页显示项目名
This commit is contained in:
freedakgmail
2026-06-14 09:02:05 +08:00
parent 1a37daea68
commit a9c41bba57
5 changed files with 65 additions and 18 deletions
+1
View File
@@ -993,6 +993,7 @@ export interface SystemLogItem {
method: string;
path: string;
targetId: string | null;
targetName: string | null;
status: number | null;
success: boolean | null;
durationMs: number | null;
+2 -1
View File
@@ -116,7 +116,8 @@ export function SystemLogs(): JSX.Element {
<td style={{ ...td, whiteSpace: 'nowrap', color: colorVar('color.text.primary') }}>{it.action}</td>
<td style={td}><span style={{ fontFamily: 'monospace', fontWeight: 700, color: it.method === 'DELETE' ? '#BE123C' : it.method === 'PUT' ? '#B45309' : '#2563EB' }}>{it.method}</span></td>
<td style={{ ...td, maxWidth: 320, wordBreak: 'break-all', color: colorVar('color.text.secondary') }}>
{it.targetId && <span style={{ color: colorVar('color.text.primary'), fontWeight: 600 }}>{it.targetId}</span>}
{it.targetName && <div style={{ color: colorVar('color.text.primary'), fontWeight: 600 }}>{it.targetName}</div>}
{it.targetId && !it.targetName && <span style={{ color: colorVar('color.text.primary'), fontWeight: 600 }}>{it.targetId}</span>}
<div style={{ fontFamily: 'monospace', fontSize: '11px' }}>{it.path}</div>
</td>
<td style={{ ...td, whiteSpace: 'nowrap' }}>