Commit Graph

3 Commits

Author SHA1 Message Date
hailin 010b0392fd feat(pre-planting): 3171 预种计划 1.0 全量实现(纯新增,零侵入)
预种计划(拼种团购):用户以 3171 USDT/份参与认种(1棵树的1/5价格),
累计5份自动合成1棵树,触发合同签署并解除交易/提现限制。

涉及服务(现有代码仅 app.module.ts 加 1 行 import,其余全部为新增文件):
- planting-service: PrePlantingModule(独立聚合根、购买/合并/签约/分配)
- admin-service: 预种开关管理(PrePlantingConfig 表 + API)
- referral-service: PrePlantingStatsModule(消费预种事件更新团队统计)
- authorization-service: PrePlantingGuardModule(未合并不可申请授权)
- wallet-service: PrePlantingGuardModule(未合并不可提现)

新增数据表:pre_planting_orders, pre_planting_positions,
pre_planting_merges, pre_planting_reward_entries, pre_planting_configs

新增 Kafka Topics:pre-planting.portion.purchased, pre-planting.merged,
pre-planting.contract.signed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 05:06:03 -08:00
hailin 747e4ae8ef refactor(mpc-system): migrate to party-driven architecture with PartyID-based routing
- Remove Address field from PartyEndpoint (parties connect to router themselves)
- Update K8s Discovery to only manage PartyID and Role labels
- Add Party registration and SessionEvent protobuf definitions
- Implement PartyRegistry and SessionEventBroadcaster domain logic
- Add RegisterParty and SubscribeSessionEvents gRPC handlers
- Prepare infrastructure for party-driven MPC coordination

This is the first phase of migrating from coordinator-driven to party-driven
architecture following international MPC system design patterns.
2025-12-05 08:11:28 -08:00
Developer 98f5d948dd feat(planting-service): Implement complete planting service with DDD architecture
- Domain Layer:
  - PlantingOrder aggregate with full lifecycle management
  - PlantingPosition aggregate for user holdings
  - PoolInjectionBatch aggregate for 5-day batch processing
  - Value objects: TreeCount, ProvinceCitySelection, FundAllocation, Money
  - Domain events for state transitions
  - FundAllocationDomainService for 10-target fund distribution (2199 USDT/tree)

- Application Layer:
  - PlantingApplicationService for order management
  - PoolInjectionService for batch processing
  - 5-second province/city confirmation mechanism

- Infrastructure Layer:
  - Prisma ORM with PostgreSQL
  - Repository implementations
  - External service clients (Wallet, Referral)
  - Object mappers

- API Layer:
  - REST controllers with Swagger documentation
  - JWT authentication guard
  - Request/Response DTOs with validation

- Testing:
  - 45+ unit tests
  - 12+ integration tests
  - 17+ E2E tests
  - Docker test environment

- Documentation:
  - Architecture design (DDD + Hexagonal)
  - API documentation
  - Development guide
  - Testing guide
  - Deployment guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 18:55:50 -08:00