Skip to content

单词管理 API

单词 /api/words

方法端点说明
GET/api/words单词列表(?limit=20&offset=0&search=xxx
GET/api/words/:id单词详情
POST/api/words创建单词
PUT/api/words/:id更新单词
DELETE/api/words/:id删除单词
POST/api/words/batch批量创建
GET/api/words/count单词总数
POST/api/words/import-urlURL 导入

Word 模型

typescript
interface Word {
  id: string;
  text: string;
  meaning: string;
  pronunciation?: string;
  partOfSpeech?: string;
  difficulty: number;    // 0-1
  examples: string[];
  tags: string[];
  createdAt: string;     // ISO 8601
}

词书 /api/wordbooks

方法端点说明
GET/api/wordbooks/system系统词书列表
GET/api/wordbooks/user用户词书列表(需认证)
POST/api/wordbooks创建用户词书
GET/api/wordbooks/:id/words词书内单词(分页)
POST/api/wordbooks/:id/words向词书添加单词
DELETE/api/wordbooks/:id/words/:word_id从词书移除单词

Wordbook 模型

typescript
interface Wordbook {
  id: string;
  name: string;
  description: string;
  bookType: "System" | "User";
  userId?: string;
  wordCount: number;
  createdAt: string;
}

单词学习状态 /api/word-states

方法端点说明
GET/api/word-states/:word_id查询单词学习状态
POST/api/word-states/batch批量查询
GET/api/word-states/due/list到期复习列表
GET/api/word-states/stats/overview状态统计概览
POST/api/word-states/:word_id/mark-mastered标记掌握
POST/api/word-states/:word_id/reset重置状态

WordLearningState 模型

typescript
interface WordLearningState {
  userId: string;
  wordId: string;
  state: "New" | "Learning" | "Reviewing" | "Mastered";
  masteryLevel: number;        // 0-1
  nextReviewDate?: string;
  halfLife: number;            // 小时
  correctStreak: number;
  totalAttempts: number;
  updatedAt: string;
}

WordForge — 智能英语学习平台