win 2a7b731484 feat(finance): implement Phase 1 core P&L service + wire into dashboard
- Add internal/service/finance/types.go: AssetType enum, param/result structs
- Add internal/service/finance/service.go: Service interface, read-only ctor
- Add internal/service/finance/query_user.go: QueryUserProfitLoss (4 fan-out scans)
- Add internal/service/finance/query_activity.go: QueryActivityProfitLoss (4 fan-out scans)
- Add internal/service/finance/service_test.go: 22 integration tests (all pass)
- Wire finance.Service into admin handler (admin.go)
- Replace dashboard_activity cost scan with finance.Service call (D-09: value_cents single source of truth)
- Revenue/gamepass/draw-count scans unchanged; response schema fully compatible

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-21 18:38:33 +08:00

1.9 KiB

Project State

Project Reference

See: .planning/PROJECT.md (updated 2026-03-21)

Core value: 提供可复用的盈亏统计方法,使平台运营能从用户和活动两个维度快速了解各类资产的收支状况 Current focus: Phase 2 — Per-Asset-Type Breakdown

Current Position

Phase: 1 of 2 (COMPLETE) → Phase 2 next Plan: 4/4 in Phase 1 complete Status: Phase 1 complete — ready to plan Phase 2 Last activity: 2026-03-21 — Phase 1 executed: QueryUserProfitLoss + QueryActivityProfitLoss implemented, 22 tests passing

Progress: [█████░░░░░] 50%

Performance Metrics

Velocity:

  • Total plans completed: 0
  • Average duration: — min
  • Total execution time: 0 hours

By Phase:

Phase Plans Total Avg/Plan
- - - -

Recent Trend:

  • Last 5 plans: —
  • Trend: —

Updated after each plan completion

Accumulated Context

Decisions

Decisions are logged in PROJECT.md Key Decisions table. Recent decisions affecting current work:

  • Init: Fan-out + in-memory merge query pattern chosen (avoids Cartesian product JOINs)
  • Init: Read-only DB routing enforced — constructor injects DbR only, no GetDbW() in package
  • Init: All existing finance.* utilities (IsGamePassOrder, ComputeProfit, etc.) must be reused, not re-derived
  • Init: Phase 2 (Fragment breakdown) requires schema verification of fragment_synthesis_logs join path before implementation

Pending Todos

None yet.

Blockers/Concerns

  • Phase 2: fragment_synthesis_logs join path and cost formula not yet verified — requires schema review during Phase 2 planning
  • Phase 1: SQLite test compatibility for CAST(AS SIGNED), GREATEST(), LIKE 'GP%' — must use Go-layer helpers or conditional SQL paths in integration tests

Session Continuity

Last session: 2026-03-21 Stopped at: Roadmap created — ROADMAP.md and STATE.md written, REQUIREMENTS.md traceability updated Resume file: None