feat(#1895): 会员积分系统后端(P1-P4,默认关闭) #1923

Closed
xiaoxia wants to merge 7 commits from feat/1895-membership-points-p1-p2 into develop

7 Commits

Author SHA1 Message Date
xiaoxia-agent 087c99c89b fix(#1895): 旧版 change-plan/toggle-auto-renew 使用 pydantic schema 校验入参
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 39s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 40s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m10s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m51s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 3m12s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 3m20s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 5m0s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 8m52s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m39s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 11s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 20s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 16m33s
CI/CD Pipeline / CI Gate (pull_request) Failing after 1s
AI Code Review / AI Code Review (pull_request) Successful in 21m10s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 27h4m31s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 27h13m13s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 27h13m19s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 27h13m20s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 27h3m54s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 27h12m43s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 27h12m26s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 27h12m32s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 27h12m36s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 27h12m36s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 27h12m42s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 27h12m43s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 27h12m25s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 27h3m53s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 27h12m26s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 27h12m49s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 27h3m53s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 27h3m54s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 27h12m43s
- /change-plan 使用 ChangePlanRequest 强校验(返回旧套餐下线提示前先校验 target_plan_id/billing_cycle 必填及合法性)
- /toggle-auto-renew 使用 ToggleAutoRenewRequest 强校验 enabled 必填
- 修复集成测试 test_error_scenarios 中 422 校验场景预期
2026-09-15 12:10:05 +08:00
CI Bot 057f2337fb style: auto-format with black + isort + ruff + prettier [skip ci-format-check] 2026-09-15 12:10:05 +08:00
xiaoxia-agent e837847e20 fix(#1895): subscription schema 补全旧版字段兼容集成测试
- SubscriptionInfo 补 plan_id/plan_name/billing_cycle/current_period_*/amount/auto_renew 等旧字段
- BillingRecord 补 plan_id/plan_name/billing_cycle/amount/status/paid_at/period_* 等旧字段
- ChangePlanRequest target_plan_id/billing_cycle 改必填(对齐 fixture 校验期望)
- ToggleAutoRenewRequest.enabled 改必填(对齐 422 校验测试)
- ChangePlanResponse 加 new_subscription 字段返回新版 SubscriptionInfo
2026-09-15 12:10:05 +08:00
CI Bot e4b36842a2 style: auto-format with black + isort + ruff + prettier [skip ci-format-check] 2026-09-15 12:10:05 +08:00
xiaoxia-agent d11d642f97 feat(#1895): P4 points_gate 扣费中间件接入 AI 路由(默认关闭)
- 新增 packages/middleware/points_gate.py:提供 _is_active_member、_insufficient_points 工具和 points_deduction contextmanager
- APISettings 新增 POINTS_ENABLED 开关(默认 False)
- 接入扣费端点:
  * tts.py: POST /synthesize、POST /preview(ai_voice,按文本长度粗估时长)
  * generation_tasks.py: POST /tasks(ai_video,按变体数扣费;免费用户每日2条免费额度,异常按单条/批量退款)
  * generation_preview.py: POST /preview(ai_video,预览同样扣费,异常退款)
  * lipsync.py: POST /jobs(ai_digital_human,按次15积分兜底)
  * ai_avatar_render.py: POST /render(ai_digital_human)
  * voice_clones.py: POST /、POST /{clone_id}/retry 打点(voice_clone_train=0积分,不退款)
  * generation_cover.py: POST /generate-cover(ai_cover,upload 类型不扣费)
  * ai.py: POST /titles/generate(ai_title,新增加鉴权)
- auth.py: 注册成功后赠送 50 积分(POINTS_ENABLED 开启时)
- POINTS_ENABLED 默认 false,不影响现有功能
- 单测 15128 passed
2026-09-15 12:09:59 +08:00
xiaoxia-agent 543c316117 feat(#1895): P3 积分API+会员API改造(余额/流水/充值/规则/每日额度/两档会员) 2026-09-15 12:09:55 +08:00
xiaoxia 1e3c6a7469 feat(#1895): P1+P2 会员积分基础建设 - DB迁移+Model+Repository+PointsService+每日免费额度 2026-09-15 12:09:48 +08:00