From 3676241f6a246c3df758be3b3af25126c6efe84e Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Wed, 17 Jun 2026 10:21:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(bugcollect):=20=E5=AF=B9=E9=BD=90=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - bugcollect.ts: issues/events 请求参数重映射(startDate/endDate→from/to,eventName→name,page 0-based+1→backend 1-based) - BugCollectPageResult: content/totalElements → items/total(匹配后端 PageResult) - BugCollectIssue: 字段对齐 IssueResponse(id:number,isResolved,移除 affectedUsers/status) - BugCollectEventItem: 字段对齐 IssueEventResponse(message/stack/createdAt,移除 eventName/timestamp/properties) - BugCollectIssueRanking: 同步 isResolved,移除 affectedUsers - 所有视图表格列更新为实际存在的字段 Co-Authored-By: Claude Sonnet 4.6 --- tenant-platform/src/api/bugcollect.ts | 86 +++++++++++-------- .../views/bug-collect/BugCollectEvents.vue | 22 ++--- .../views/bug-collect/BugCollectIssues.vue | 6 +- .../views/bug-collect/BugCollectRankFreq.vue | 2 +- .../views/bug-collect/BugCollectRankRisk.vue | 2 +- 5 files changed, 69 insertions(+), 49 deletions(-) diff --git a/tenant-platform/src/api/bugcollect.ts b/tenant-platform/src/api/bugcollect.ts index f06a6b5..5fa562f 100644 --- a/tenant-platform/src/api/bugcollect.ts +++ b/tenant-platform/src/api/bugcollect.ts @@ -11,53 +11,65 @@ export interface BugCollectOverview { topIssues: { id: string; title: string; type: string; count: number }[] } +// Matches backend IssueResponse export interface BugCollectIssue { - id: string - title: string + id: number + appKey: string + fingerprint?: string type: string - platform: string - count: number - affectedUsers: number - lastSeenAt: string + title: string firstSeenAt: string - status: string + lastSeenAt: string + count: number + isResolved: boolean + platform: string + appVersion?: string } +// Matches backend IssueResponse (with events embedded) export interface BugCollectIssueDetail { - id: string - title: string + id: number + appKey: string + fingerprint?: string type: string - platform: string - appVersion: string - osVersion: string - deviceModel: string - count: number - affectedUsers: number + title: string firstSeenAt: string lastSeenAt: string - status: string - stackTrace: string - sourceContext?: { line: number; content: string; highlight: boolean }[] - recentEvents: BugCollectEventItem[] + count: number + isResolved: boolean + platform: string + appVersion?: string + events?: BugCollectEventItem[] } +// Matches backend IssueEventResponse export interface BugCollectEventItem { - id: string - eventName: string - userId: string - timestamp: string - properties: Record + id: number + issueId?: number + appKey?: string + userId?: string + sessionId?: string + message?: string + stack?: string + stackSymbolicated?: string + metadata?: string + platform?: string + appVersion?: string + createdAt: string } +// Matches backend IssueResponse used for rankings export interface BugCollectIssueRanking { - id: string + id: number title: string type: string platform: string count: number - affectedUsers: number - riskScore?: number + isResolved: boolean + firstSeenAt: string lastSeenAt: string + appVersion?: string + riskScore?: number } export interface BugCollectFunnelStep { @@ -76,12 +88,12 @@ export interface BugCollectWebhook { updatedAt: string } +// Matches backend PageResult (items/total, not content/totalElements) export interface BugCollectPageResult { - content: T[] + items: T[] page: number size: number - totalElements: number - totalPages: number + total: number } // ── API ───────────────────────────────────────────────────────────────────── @@ -91,7 +103,7 @@ export const bugCollectApi = { overview: (appKey: string) => client.get<{ data: BugCollectOverview }>('/bugcollect/v1/overview', { params: { appKey } }), - // Issues + // Issues — page is 1-based (backend convention); startDate/endDate mapped to from/to issues(appKey: string, params: { type?: string platform?: string @@ -100,7 +112,10 @@ export const bugCollectApi = { page?: number size?: number }) { - return client.get<{ data: BugCollectPageResult }>('/bugcollect/v1/issues', { params: { appKey, ...params } }) + const { startDate, endDate, page, ...rest } = params + return client.get<{ data: BugCollectPageResult }>('/bugcollect/v1/issues', { + params: { appKey, ...rest, from: startDate, to: endDate, page: (page ?? 0) + 1 }, + }) }, issueDetail(id: string) { @@ -116,7 +131,7 @@ export const bugCollectApi = { return client.get<{ data: BugCollectIssueRanking[] }>('/bugcollect/v1/issues/rankings/risk', { params: { appKey } }) }, - // Events + // Events — eventName→name, startDate/endDate→from/to, page is 0-based from caller → +1 for backend events(appKey: string, params: { eventName?: string userId?: string @@ -125,7 +140,10 @@ export const bugCollectApi = { page?: number size?: number }) { - return client.get<{ data: BugCollectPageResult }>('/bugcollect/v1/events', { params: { appKey, ...params } }) + const { eventName, startDate, endDate, page, ...rest } = params + return client.get<{ data: BugCollectPageResult }>('/bugcollect/v1/events', { + params: { appKey, ...rest, name: eventName, from: startDate, to: endDate, page: (page ?? 0) + 1 }, + }) }, // Funnel diff --git a/tenant-platform/src/views/bug-collect/BugCollectEvents.vue b/tenant-platform/src/views/bug-collect/BugCollectEvents.vue index 670a1d9..90d2cc6 100644 --- a/tenant-platform/src/views/bug-collect/BugCollectEvents.vue +++ b/tenant-platform/src/views/bug-collect/BugCollectEvents.vue @@ -58,20 +58,22 @@
- - - + + + + + - + @@ -137,8 +139,8 @@ async function loadData() { size: pageSize.value, }) const data = res.data.data - events.value = data.content ?? [] - total.value = data.totalElements ?? 0 + events.value = data.items ?? [] + total.value = data.total ?? 0 } catch { } finally { loading.value = false diff --git a/tenant-platform/src/views/bug-collect/BugCollectIssues.vue b/tenant-platform/src/views/bug-collect/BugCollectIssues.vue index b580d25..ece1f80 100644 --- a/tenant-platform/src/views/bug-collect/BugCollectIssues.vue +++ b/tenant-platform/src/views/bug-collect/BugCollectIssues.vue @@ -67,7 +67,7 @@ - +