c08d3f75b9
实现每日首次进入红心补给
2026-05-13 10:53:27 +08:00
d71c45b2f1
实现连续学习里程碑奖励
2026-05-13 10:51:01 +08:00
447cef3dea
按挑战组完成更新连续学习
2026-05-13 10:47:46 +08:00
b5b3aaf3a7
实现游戏化 XP 来源与连对奖励
2026-05-13 10:26:21 +08:00
b590e60bce
feat: implement non-linear 50-level XP curve (G2-1)
...
Replace flat 400 XP/level formula with the segmented curve from
LEVEL_RULES: Lv.1-5 steep ramp, Lv.6-10 moderate, Lv.11-20 linear +80,
Lv.21-35 +120, Lv.36-50 +180. Level 50 is hard-capped with xpToNextLevel=0.
Uses binary search over pre-computed cumulative thresholds for O(log n)
level lookup.
2026-05-12 11:04:23 +08:00
665efa4370
test: add comprehensive challenge group tests (G1-7)
...
Add 11 new test cases covering challenge session creation, correct/wrong
answers, idempotent duplicate submission, completion settlement, resource
exhaustion, Plus user bypass, and invalid input validation.
Refactor test helpers to use queue-based mockImplementation pattern for
more reliable db.select mocking across complex async flows.
2026-05-12 10:38:17 +08:00
8801ca1db2
docs: mark G1-6 challenge API DTO update as completed
2026-05-12 00:12:50 +08:00
e2fdce2268
docs: mark G1-5 daily high-reward session limits as completed
2026-05-12 00:01:57 +08:00
708165e121
docs: mark G1-4 heart deduction boundaries as completed
2026-05-11 23:45:07 +08:00
9e0f97d162
Settle completed challenge sessions
2026-05-11 21:40:41 +08:00
5bb6ba29a2
Record idempotent challenge answers
2026-05-11 21:34:27 +08:00
1d84de8d15
Create challenge sessions with five questions
2026-05-11 18:32:40 +08:00
fd4c2b6361
Generate game economy migrations
2026-05-11 18:23:29 +08:00
6a655d0ce2
Add weekly XP schema
2026-05-11 18:18:33 +08:00
7a617ce1f9
Add daily progress schema
2026-05-11 18:06:19 +08:00
51395bf5ec
Add reward ledger schema
2026-05-11 17:59:03 +08:00
a23f1abc12
Add wallet and inventory schema
2026-05-11 17:41:26 +08:00
5570973f74
Add challenge session schema
2026-05-11 17:39:06 +08:00
8382183ee5
Add gamification rule constants
2026-05-11 17:33:53 +08:00
0dd6633fd4
Add gamification design and server plan
2026-05-11 17:06:42 +08:00
2649b24277
Add ad recovery API contract
2026-05-05 16:12:04 +08:00
5b1f0848ac
feat: 添加管理员修改自己密码的接口
...
CI/CD Pipeline / Code Quality (push) Failing after 17s
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Build & Deploy Test (push) Has been skipped
CI/CD Pipeline / Build & Deploy Production (push) Has been skipped
新增 PUT /v1/admin/change-password 端点,允许已登录管理员
(admin / super_admin)修改自己的密码。需验证旧密码,
且新旧密码不能相同。错误由全局 errorHandler 统一处理。
2026-04-23 12:32:31 +08:00
b75a7ada75
docs: 更新 CI 部署文档至 v5.3.0
...
同步实际部署配置变更:
- Docker Compose 使用 network_mode: host 避免 VPC 冲突
- Act Runner config 补充 options + valid_volumes 挂载配置
- 移除 systemd 不必要的 BindPaths
- CI health check 改用 bun fetch
- 新增 Docker bridge/VPC 冲突和 health check 故障排查
2026-04-18 04:23:16 +08:00
567613aa6b
docs: 更新 CI 部署文档 v5.1.0 → v5.2.0
...
主要更新:
- Runner 镜像:添加 Docker CLI,固定 Bun 版本为 1.3
- systemd 服务:添加 Docker socket 挂载配置
- CI 流程:移除覆盖率相关描述(只运行单元测试)
- 关键设计说明:更新 Runner 镜像和 Docker socket 挂载说明
2026-04-17 16:33:35 +08:00
7856d53635
docs: 更新 CI 部署文档,补充国内网络适配配置
...
- 新增 Docker 镜像加速配置(服务器初始化)
- 重写 Act Runner 安装章节:自定义镜像构建、config.yaml 关键配置、systemd --config 参数
- 补充三个国内网络问题的解决方案:Docker Hub 加速、github_mirror、--network host
- 更新故障排查:新增 Action 拉取失败、checkout 失败两个排查项
- 更新目录结构:新增 act-runner/ 和 runner-image/
- 版本更新至 v5.1.0
2026-04-17 14:01:25 +08:00
2a02c19dcb
refactor: 统一使用 Docker Compose V2 命令语法
...
CI/CD Pipeline / Code Quality (push) Failing after 15s
CI/CD Pipeline / Unit Tests (push) Has been skipped
CI/CD Pipeline / Build Test Image (push) Has been skipped
CI/CD Pipeline / Build Production Image (push) Has been skipped
CI/CD Pipeline / Deploy to Test (push) Has been skipped
CI/CD Pipeline / Deploy to Production (push) Has been skipped
将所有 docker-compose(V1)替换为 docker compose(V2):
- CI/CD 流水线、部署脚本、文档中的命令调用
- 安装包名 docker-compose → docker-compose-plugin
2026-04-17 00:31:49 +08:00
3623ad04b6
docs: 添加 JWT_SECRET 和 ADMIN_TOKEN 生成方式说明
...
在环境变量模板和部署文档中添加了密钥生成的安全实践说明,
包括 openssl 和 Node.js 两种生成方式,以及相关的安全提示。
2026-04-16 16:02:01 +08:00
e893755340
feat: 添加 CI/CD 部署方案(Gitea + Docker + 双分支工作流)
...
- Dockerfile: 多阶段构建,oven/bun 基础镜像,非 root 用户
- docker-compose.yml: 本地开发环境(API + MySQL + Drizzle Studio)
- docker-compose.prod.yml: 服务器部署(prod + test,Docker profiles)
- .gitea/workflows/deploy.yml: 双分支 CI/CD(develop→测试, main→生产)
- docs/ci-deployment-guide.md: 完整部署指南(Alibaba Cloud Linux 3)
- scripts/deploy.sh: 手动部署运维脚本
- .env.prod.example: 生产环境变量模板
- .dockerignore: 排除非构建文件
- .gitignore: 排除 .claude/ 目录
2026-04-16 12:44:14 +08:00
db2f3af8a3
feat: 完善题目列表查询接口,支持搜索、多维筛选和排序
...
- 新增关键词搜索(同时匹配题干 stem 和选项 distractors)
- 新增按难度(difficulty)、来源(source)筛选
- 新增动态排序:支持 createdAt/updatedAt/difficulty,可选 asc/desc
- 路由层增加 sortBy/sortOrder 白名单校验
2026-04-12 00:04:11 +08:00
aeebcba77c
feat: 添加题目批量导入接口(JSON + CSV)
...
- POST /admin/questions/import 支持 JSON 数组导入(1-200 条)
- POST /admin/questions/import-csv 支持 CSV 文本导入
- 全有或全无事务策略,先验校验后统一插入
- 包含 categoryId 外键存在性校验
- CSV 解析器支持引号内逗号、换行和 "" 转义
2026-04-11 23:23:09 +08:00
1b142f2866
feat: 添加题目批量发布、归档和删除接口
...
- 新增 batchUpdateStatus 通用方法,带状态流转校验和 BatchResult 报告
- 改造 batchPublish 使用新方法,返回成功/失败详情
- 新增 batchArchive 和 batch-delete 端点(软删除)
- 使用 inArray 批量查询和更新,优化数据库往返
- 更新 API 文档,补充三个批量接口说明
2026-04-11 22:19:02 +08:00
6a5490dea4
feat: 添加题目状态变更接口(带流转校验)
...
新增 PATCH /admin/questions/:id/status 接口,支持题目状态流转并校验合法性:
- draft → reviewing, archived
- reviewing → published, draft, archived
- published → archived
- archived → draft
2026-04-11 21:17:34 +08:00
f260fd6bfb
feat: 添加管理员管理 API
...
- 新增管理员类型定义 (src/types/admin.ts)
- 新增管理员管理服务 (src/services/admin/admin-management-service.ts)
- 新增管理员管理路由 (src/routes/admin/admins.ts)
- 更新 API 参考文档
功能:
- GET /v1/admin/admins - 获取管理员列表(支持分页和筛选)
- GET /v1/admin/admins/:id - 获取管理员详情
- POST /v1/admin/admins - 创建管理员(super_admin 专属)
- PUT /v1/admin/admins/:id - 更新管理员信息(super_admin 专属)
- DELETE /v1/admin/admins/:id - 软删除管理员(super_admin 专属)
- POST /v1/admin/admins/:id/reset-password - 重置密码(super_admin 专属)
安全特性:
- BCrypt 密码哈希
- 随机密码生成(12 位,包含大小写字母、数字、符号)
- 软删除机制
- 防止删除最后一个 super_admin
- 防止管理员修改自己的关键信息
- 使用 Drizzle ORM ne() 操作符防止 SQL 注入
2026-04-11 18:36:24 +08:00
3991a02a8c
feat: 添加管理员用户名密码登录功能
...
新增 /v1/admin/auth/login 接口,支持用户名密码登录获取 JWT Token。
- 添加 admin_users 表存储管理员账号和哈希密码
- 使用 bcryptjs 进行密码哈希(cost=10)
- JWT Token 认证优先,保留 ADMIN_TOKEN 作为向后兼容
- 记录登录审计日志到 admin_audit_log
- 种子数据创建默认管理员(username: admin, password: admin123)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 15:25:31 +08:00
4c0419649b
docs: update admin categories API with pagination parameters
...
- Add page/limit query parameters documentation
- Update response format to include pagination metadata
- Specify parameter constraints (page ≥ 1, limit 1-50)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-11 12:57:24 +08:00
2dd5f18822
docs: add API reference and environment variable guide
...
- docs/api-reference.md: comprehensive API documentation for client and admin endpoints
- docs/env-secrets-guide.md: guide for generating secure keys and tokens
2026-04-11 12:01:53 +08:00
b872b1cad9
feat: implement Phase 1b core features and Phase 1c commercialization
...
Phase 1b — Core Features:
- Huawei ID Kit login (token exchange + user info) with guest mode
- Quiz engine: randomized questions, distractor shuffling, answer verification
- XP service with combo bonuses (3/5/10-hit streaks), daily reset
- Streak service: >=3 correct/day, freeze, UTC date handling
- Hearts service: 5/day, 30min auto-restore, Pro unlimited
- 50 quiz questions across 3 categories (history/drama/crosstalk)
- 13 skill tree chapters with linear progression
- Idempotent seed import script (categories → skill tree → questions)
- 7 admin CRUD services (questions, categories, knowledge cards,
skill tree, users, stats, feedback) with Zod validation
- All routes use Zod schema validation, /auth/me endpoint
Phase 1c — Commercialization:
- Leaderboard with live XP ranking, 10 tiers, weekly settlement
- Achievement system with 15 seed achievements and condition checking
- Huawei IAP receipt verification + subscription management
- Differentiated rate limiting (auth 10/min, quiz 60/min)
- Admin audit logging middleware
Infrastructure:
- Vitest test framework with DB mock utilities (19 tests passing)
- 12 DB tables (5 new: question_ratings, user_feedback, achievements,
user_achievements, leaderboard_snapshots, subscriptions, admin_audit_log)
- TypeScript strict mode: zero errors
2026-04-09 00:12:12 +08:00