feat: 分析模块、接口管理及其他功能优化
- 后端: WebMvcConfig/拦截器/AnalyticsService/Mapper/测试优化,新增 Knife4jConfig、AnalyticsDictionary、数据库迁移脚本 - 前端: 分析仪表盘 UI 优化、接口管理列表及详情测试面板 - 小程序: analytics 服务优化、request 增强 - 文档: 分析模块中文标签设计文档、品牌重命名设计文档 - 部署: conf 配置优化、deploy.py 脚本更新 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# Analytics Chinese Business Labels Implementation Plan
|
||||
|
||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** Make the behavior analytics page display Chinese business descriptions for events, pages, buttons, preferences, and API calls.
|
||||
|
||||
**Architecture:** Add a backend analytics dictionary that enriches aggregation DTOs with Chinese labels, add request-level API analytics in the mini program, and update web-admin to consume label fields and show an API call panel.
|
||||
|
||||
**Tech Stack:** Spring Boot, MyBatis Plus, Vue 3, Element Plus, ECharts, uni-app mini program.
|
||||
|
||||
---
|
||||
|
||||
### Task 1: Backend Analytics Dictionary
|
||||
|
||||
**Files:**
|
||||
- Create: `backend-single/src/main/java/com/emotion/service/analytics/AnalyticsDictionary.java`
|
||||
- Modify: `backend-single/src/main/java/com/emotion/dto/response/analytics/AnalyticsTopEventItem.java`
|
||||
- Modify: `backend-single/src/main/java/com/emotion/dto/response/analytics/AnalyticsTrendItem.java`
|
||||
- Modify: `backend-single/src/main/java/com/emotion/dto/response/analytics/AnalyticsPreferenceItem.java`
|
||||
|
||||
- [x] Add event, event type, page, dimension, value, and API label maps.
|
||||
- [x] Add DTO fields for Chinese labels while keeping original keys.
|
||||
- [x] Add helper methods for page and API labels.
|
||||
|
||||
### Task 2: Backend Aggregation Enrichment
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend-single/src/main/java/com/emotion/mapper/AnalyticsEventMapper.java`
|
||||
- Modify: `backend-single/src/main/java/com/emotion/service/impl/AnalyticsServiceImpl.java`
|
||||
|
||||
- [x] Query `page_path` and `api_path` for top events.
|
||||
- [x] Fill `eventLabel`, `eventTypeLabel`, `pageLabel`, `apiLabel` in top events.
|
||||
- [x] Fill trend event labels and preference labels.
|
||||
- [x] Replace funnel labels with Chinese labels.
|
||||
|
||||
### Task 3: Mini Program API Analytics
|
||||
|
||||
**Files:**
|
||||
- Modify: `mini-program/src/services/request.js`
|
||||
|
||||
- [x] Add API label map.
|
||||
- [x] Track `api_request_success` and `api_request_fail`.
|
||||
- [x] Include path, method, status, label, and duration.
|
||||
- [x] Skip `/analytics/events/batch`.
|
||||
|
||||
### Task 4: Admin Analytics Page
|
||||
|
||||
**Files:**
|
||||
- Modify: `web-admin/src/api/analytics.ts`
|
||||
- Modify: `web-admin/src/views/analytics/AnalyticsDashboard.vue`
|
||||
|
||||
- [x] Add TypeScript fields for backend labels.
|
||||
- [x] Render chart legend with `eventLabel`.
|
||||
- [x] Replace all visible analytics text with Chinese.
|
||||
- [x] Add API call table using top events filtered by `api` type.
|
||||
- [x] Show Chinese page and preference labels.
|
||||
|
||||
### Task 5: Verification
|
||||
|
||||
**Commands:**
|
||||
- `cd backend-single && mvn test`
|
||||
- `cd web-admin && npm run build`
|
||||
- `cd mini-program && npm run build:mp-weixin` or available project build command
|
||||
- `git diff --check`
|
||||
|
||||
- [x] Backend tests pass.
|
||||
- [x] web-admin build passes.
|
||||
- [x] mini-program build/check passes.
|
||||
- [x] Diff check has no new whitespace errors.
|
||||
Reference in New Issue
Block a user