feat: add dashboard metrics service
This commit is contained in:
+6
-4
@@ -123,16 +123,18 @@
|
||||
运行日志用于排错,可以记录错误详情和模块名。
|
||||
当前已接入图片任务创建失败和服务内部错误路径。
|
||||
|
||||
## 目标新增服务
|
||||
|
||||
### MetricsService
|
||||
|
||||
目标方法:
|
||||
文件:`internal/services/metrics_service.go`
|
||||
|
||||
- `GetDashboardMetrics() (DashboardMetrics, error)`:返回今日处理图片数、成功率、平均耗时、失败数、今日操作日志数。
|
||||
- `GetProcessingTrend(days int) ([]DailyMetric, error)`:返回最近 N 天处理趋势。
|
||||
|
||||
统计早期直接基于 `image_tasks`、`image_task_results`、`audit_logs` 聚合。
|
||||
约束:
|
||||
|
||||
- 统计按本机本地自然日计算,查询时转换为 UTC 字符串匹配现有 `created_at`。
|
||||
- `days <= 0` 时默认 7 天,最大 30 天。
|
||||
- 当前直接基于 `image_tasks` 和 `audit_logs` 聚合,不新增统计缓存表。
|
||||
|
||||
## 前端绑定
|
||||
|
||||
|
||||
Reference in New Issue
Block a user