duoqi-api/content/achievements.json
Wang Zhuoxuan 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

108 lines
2.7 KiB
JSON

[
{
"type": "behavior",
"name": "初出茅庐",
"description": "完成第一次答题",
"iconUrl": null,
"condition": { "type": "total_answers", "value": 1 }
},
{
"type": "behavior",
"name": "勤学好问",
"description": "累计答题 50 道",
"iconUrl": null,
"condition": { "type": "total_answers", "value": 50 }
},
{
"type": "behavior",
"name": "学海无涯",
"description": "累计答题 200 道",
"iconUrl": null,
"condition": { "type": "total_answers", "value": 200 }
},
{
"type": "behavior",
"name": "百发百中",
"description": "累计答对 50 道",
"iconUrl": null,
"condition": { "type": "correct_answers", "value": 50 }
},
{
"type": "behavior",
"name": "知识达人",
"description": "累计答对 200 道",
"iconUrl": null,
"condition": { "type": "correct_answers", "value": 200 }
},
{
"type": "behavior",
"name": "三日不休",
"description": "连续学习 3 天",
"iconUrl": null,
"condition": { "type": "streak_days", "value": 3 }
},
{
"type": "behavior",
"name": "七日之约",
"description": "连续学习 7 天",
"iconUrl": null,
"condition": { "type": "streak_days", "value": 7 }
},
{
"type": "behavior",
"name": "月度学霸",
"description": "连续学习 30 天",
"iconUrl": null,
"condition": { "type": "streak_days", "value": 30 }
},
{
"type": "behavior",
"name": "百日坚持",
"description": "连续学习 100 天",
"iconUrl": null,
"condition": { "type": "streak_days", "value": 100 }
},
{
"type": "behavior",
"name": "初露锋芒",
"description": "累计获得 100 XP",
"iconUrl": null,
"condition": { "type": "xp_total", "value": 100 }
},
{
"type": "behavior",
"name": "锋芒毕露",
"description": "累计获得 1000 XP",
"iconUrl": null,
"condition": { "type": "xp_total", "value": 1000 }
},
{
"type": "behavior",
"name": "登峰造极",
"description": "累计获得 5000 XP",
"iconUrl": null,
"condition": { "type": "xp_total", "value": 5000 }
},
{
"type": "knowledge",
"name": "初次通关",
"description": "通过第一个章节",
"iconUrl": null,
"condition": { "type": "chapters_passed", "value": 1 }
},
{
"type": "knowledge",
"name": "小有所成",
"description": "通过 5 个章节",
"iconUrl": null,
"condition": { "type": "chapters_passed", "value": 5 }
},
{
"type": "knowledge",
"name": "博学多才",
"description": "通过全部章节",
"iconUrl": null,
"condition": { "type": "chapters_passed", "value": 13 }
}
]