Files
happy-life-star/docs/superpowers/plans/2026-05-23-analytics-chinese-business-labels.md
peanut 9838e7626b feat: 分析模块、接口管理及其他功能优化
- 后端: WebMvcConfig/拦截器/AnalyticsService/Mapper/测试优化,新增 Knife4jConfig、AnalyticsDictionary、数据库迁移脚本
- 前端: 分析仪表盘 UI 优化、接口管理列表及详情测试面板
- 小程序: analytics 服务优化、request 增强
- 文档: 分析模块中文标签设计文档、品牌重命名设计文档
- 部署: conf 配置优化、deploy.py 脚本更新

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 23:52:39 +08:00

2.9 KiB

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

  • Add event, event type, page, dimension, value, and API label maps.

  • Add DTO fields for Chinese labels while keeping original keys.

  • 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

  • Query page_path and api_path for top events.

  • Fill eventLabel, eventTypeLabel, pageLabel, apiLabel in top events.

  • Fill trend event labels and preference labels.

  • Replace funnel labels with Chinese labels.

Task 3: Mini Program API Analytics

Files:

  • Modify: mini-program/src/services/request.js

  • Add API label map.

  • Track api_request_success and api_request_fail.

  • Include path, method, status, label, and duration.

  • 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

  • Add TypeScript fields for backend labels.

  • Render chart legend with eventLabel.

  • Replace all visible analytics text with Chinese.

  • Add API call table using top events filtered by api type.

  • 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

  • Backend tests pass.

  • web-admin build passes.

  • mini-program build/check passes.

  • Diff check has no new whitespace errors.