feat: 原始上报数据存储(raw_batch 表/脱敏/访客关联/详情页 Tab/30天清理)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-16 15:42:06 +08:00
parent 1cadee16bd
commit 21ca43248a
10 changed files with 534 additions and 6 deletions
+27
View File
@@ -93,6 +93,26 @@ export interface VisitorListResp {
page: number
}
/** 原始上报批次行(visitors.py `VisitorRawBatchesView`) */
export interface RawBatchRow {
id: number
batch_id: string
/** accepted / partial / rejected */
status: string
event_count: number
rejected_count: number
received_at: string
/** 脱敏后的整包 JSON 文本(敏感值已 [FILTERED]、被拒批次已截断)——只做文本渲染,禁 v-html */
body: string
}
/** 原始批次列表响应 */
export interface RawBatchListResp {
list: RawBatchRow[]
total: number
page: number
}
/**
* 访客列表筛选参数。
* online/is_new/show_bot 是后端字符串哨兵(仅 "1" 生效,见 visitors.py `_page_visitors`)——
@@ -135,3 +155,10 @@ export const getSession = (visitorId: string, sessionId: string) =>
request.get<SessionSummary & { events: TimelineEvent[] }>({
url: `/admin/visitors/${visitorId}/sessions/${sessionId}`
})
/** 访客原始上报批次(page_size 10,按接收时间倒序;404 时后端返回 visitor_not_found) */
export const getRawBatches = (visitorId: string, page = 1) =>
request.get<RawBatchListResp>({
url: `/admin/visitors/${visitorId}/raw-batches`,
params: { page }
})