API-INFO-019 P0 | 纯数据 trend 接口 【status:partial】 #117

Closed
opened 2026-06-07 11:03:39 +08:00 by wangdl · 2 comments
Owner

目标

GET /learning/trend?days=7

规则

  • 不调用 AI(与 /activity/trend 的 AI 分析分离)
  • days 默认 7,最大 90
  • 没有数据日期补 0
  • 日期升序返回

详见设计文档 API-INFO-000。

## 目标 ```http GET /learning/trend?days=7 ``` ### 规则 - 不调用 AI(与 /activity/trend 的 AI 分析分离) - days 默认 7,最大 90 - 没有数据日期补 0 - 日期升序返回 详见设计文档 API-INFO-000。
wangdl added this to the M8:学习信息收集与基础分析闭环 milestone 2026-06-07 11:03:39 +08:00
wangdl changed title from API-INFO-012 P1 | 学习趋势接口 to API-INFO-019 P0 | 纯数据 trend 接口 2026-06-07 11:22:19 +08:00
wangdl changed title from API-INFO-019 P0 | 纯数据 trend 接口 to API-INFO-019 P0 | 纯数据 trend 接口 【status:partial】 2026-06-07 19:04:17 +08:00
Author
Owner

审查结论:当前 API 项目学习信息收集体系基本为全新建设。可复用:JWT Guard、LearningSession 基础表/CRUD、DailyLearningActivity 基础表、ActivityController 部分接口、LearningRecord schema。其余 ReadingEvent/TemporaryMaterial/Progress/批量上报/Processor/聚合/查询接口/错误码/去重/权限/测试/文档均不存在或仅部分存在。

本 Issue: /activity/trend 存在但带 AI 分析(15s超时)。需纯数据版 /learning/trend。blocked-by:api-info-core

标签: audit:reviewed audit:api-info status:partial work:extend-existing,work:api

## 审查结论:当前 API 项目学习信息收集体系基本为全新建设。可复用:JWT Guard、LearningSession 基础表/CRUD、DailyLearningActivity 基础表、ActivityController 部分接口、LearningRecord schema。其余 ReadingEvent/TemporaryMaterial/Progress/批量上报/Processor/聚合/查询接口/错误码/去重/权限/测试/文档均不存在或仅部分存在。 **本 Issue**: /activity/trend 存在但带 AI 分析(15s超时)。需纯数据版 /learning/trend。blocked-by:api-info-core **标签**: audit:reviewed audit:api-info status:partial work:extend-existing,work:api
Author
Owner

完成报告

交付

GET /learning/trend?days=7 — 阅读趋势:

{
  "days": 7,
  "series": [
    { "date": "2026-06-02", "value": 120 },
    { "date": "2026-06-03", "value": 0 },
    { "date": "2026-06-04", "value": 300 },
    ...
  ]
}

规则实现:

  • days 默认 7,最大 90
  • 不调用 AI(纯数据)
  • 无数据日期补 0
  • 日期升序返回

实现:

getTrend(req, daysStr) {
  const days = Math.min(Number(daysStr ?? 7) || 7, 90);
  // 从 DailyLearningActivity 聚合 readingSeconds 按日期
  // 生成 days 天的连续日期序列,无数据补 0
}
## 完成报告 ### 交付 **`GET /learning/trend?days=7`** — 阅读趋势: ```json { "days": 7, "series": [ { "date": "2026-06-02", "value": 120 }, { "date": "2026-06-03", "value": 0 }, { "date": "2026-06-04", "value": 300 }, ... ] } ``` **规则实现:** - days 默认 7,最大 90 ✅ - 不调用 AI(纯数据)✅ - 无数据日期补 0 ✅ - 日期升序返回 ✅ **实现:** ```typescript getTrend(req, daysStr) { const days = Math.min(Number(daysStr ?? 7) || 7, 90); // 从 DailyLearningActivity 聚合 readingSeconds 按日期 // 生成 days 天的连续日期序列,无数据补 0 } ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/api-server#117
No description provided.