hailin
2613a601b4
chore: update MinIO credentials in .env.example files
...
Sync MINIO_SECRET_KEY default value with MinIO server config
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 23:22:45 -08:00
hailin
b1e51bd73b
fix: change MINIO_PUBLIC_URL from cdn to minio.szaiai.com
...
CDN domain has nginx host header issue, use minio.szaiai.com directly
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 22:26:30 -08:00
hailin
91c8bba80d
fix(identity-service): configure MinIO to connect to external server
...
- Update MINIO_ENDPOINT from localhost to 192.168.1.100 (Server A)
- Add MinIO environment variables to docker-compose.yml
- Set MINIO_PUBLIC_URL to https://cdn.szaiai.com for CDN access
- Add MinIO config section to backend/services/.env.example
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 22:22:55 -08:00
hailin
81cd90eae0
fix(identity): add StorageService to InfrastructureModule in app.module.ts
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 21:53:06 -08:00
hailin
0989d914de
chore(identity): update package-lock.json for minio and multer
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 21:42:16 -08:00
hailin
550a3dba06
feat(identity): add avatar upload with MinIO storage
...
- Add StorageService for MinIO object storage operations
- Add upload-avatar API endpoint with file validation
- Support jpg, png, gif, webp formats (max 5MB)
- Auto-update user profile after avatar upload
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 21:38:35 -08:00
hailin
c1670d2439
feat(mnemonic): add recovery mnemonic generation and backup confirmation
...
Backend (blockchain-service):
- Add RecoveryMnemonicAdapter to generate 12-word BIP39 mnemonic
- Generate mnemonic when wallet addresses are derived (linked to public key)
- Include mnemonic in WalletAddressCreated event
Backend (identity-service):
- Add RecoveryMnemonic table with revocation/replacement support
- Save encrypted mnemonic to database on WalletAddressCreated event
- Add PUT /user/mnemonic/backup API to mark mnemonic as backed up
- Clear plaintext mnemonic from Redis after backup confirmation
Frontend (mobile-app):
- Update markMnemonicBackedUp() to call backend API
- Fix verify_mnemonic_page validation logic:
- Checkbox checked → pass directly
- Not checked → must select correct word
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 12:32:10 -08:00
hailin
8e9eb0ef19
fix(identity): add device_info columns to user_devices migration
...
- Add device_info JSONB column for storing complete device info
- Add platform, device_model, os_version, app_version columns
- Add screen_width, screen_height, locale, timezone columns
- Add idx_platform index
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:42:55 -08:00
hailin
29f2dc0524
fix(identity): remove address from updateProfile and fix deviceInfo type
...
- Remove dto.address parameter from updateProfile controller
- Remove address property from updateProfile service
- Fix deviceInfo JSON serialization for Prisma InputJsonValue type
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:29:51 -08:00
hailin
79345a20cf
fix(identity): update migration to TEXT avatar and remove province/city/address
...
- Change avatar_url column from VARCHAR(500) to TEXT
- Remove province_code, city_code, address columns from user_accounts
- Remove idx_province_city index
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:28:09 -08:00
hailin
2705812826
refactor(identity): remove province/city/address fields
...
- Remove provinceCode, cityCode, address from UserAccount aggregate
- Remove ProvinceCode, CityCode value objects
- Remove UserLocationUpdatedEvent domain event
- Update Prisma schema to drop province/city/address columns
- Update repository, mapper, handlers, services and DTOs
- Clean up tests and factory files
Province/city should belong to adoption-service as transaction data,
not identity-service user data.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:23:26 -08:00
hailin
fbec0b9112
feat(identity): store complete deviceInfo JSON from frontend
...
- Add deviceInfo JSON field to UserDevice table (Prisma schema)
- Update DeviceInfo value object to use deviceInfo instead of HardwareInfo
- Update repository to save complete JSON with redundant fields for queries
- Update mapper to read deviceInfo from database
- Update aggregate and handlers to pass deviceInfo through
- Allow any fields in DeviceNameInput interface with index signature
100% preserve original device info JSON from frontend without extraction
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 11:08:37 -08:00
hailin
592f13e939
refactor(identity-service): 简化DeviceNameDto为接收任意JSON对象
...
- 将DeviceNameDto从class改为interface
- 使用@IsObject()验证,允许前端传递任意设备信息字段
- 添加index signature允许扩展字段
- 后端只提取需要的字段存储到数据库
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 10:59:45 -08:00
hailin
0c7f9b6da9
feat(identity-service): 扩展DeviceNameDto支持更多设备信息字段
...
添加以下可选字段:
- brand: 品牌
- manufacturer: 厂商
- device: 设备名
- product: 产品名
- hardware: 硬件名
- sdkInt: SDK版本(Android)
- isPhysicalDevice: 是否真机
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 10:58:47 -08:00
hailin
657b66c9e5
fix: 修复钱包API路径和avatarUrl字段长度问题
...
- identity-service: avatarUrl字段从VarChar(2000)改为Text类型
- mobile-app: 修复getWalletInfo API路径从/user/$id/wallet改为/user/wallet
- mobile-app: 添加userWallet端点常量
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 10:53:40 -08:00
hailin
51be55d315
feat(reward): 补全10种认种奖励分配规则
...
新增4种系统费用类权益:
- COST_FEE: 成本费 400 USDT → 成本账户(userId=2)
- OPERATION_FEE: 运营费 300 USDT → 运营账户(userId=3)
- HEADQUARTERS_BASE_FEE: 总部社区基础费 9 USDT → 总部社区(userId=1)
- RWAD_POOL_INJECTION: RWAD底池注入 800 USDT → 底池账户(userId=4)
原有6种用户权益类保持不变:
- SHARE_RIGHT: 分享权益 500 USDT
- PROVINCE_AREA_RIGHT: 省区域权益 15 USDT + 1%算力
- PROVINCE_TEAM_RIGHT: 省团队权益 20 USDT
- CITY_AREA_RIGHT: 市区域权益 35 USDT + 2%算力
- CITY_TEAM_RIGHT: 市团队权益 40 USDT
- COMMUNITY_RIGHT: 社区权益 80 USDT
总计: 400 + 300 + 9 + 800 + 500 + 15 + 20 + 35 + 40 + 80 = 2199 USDT
同时更新seed脚本创建4个系统账户
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 09:19:20 -08:00
hailin
667ca1527a
feat(blockchain-service): add Prisma migration files
...
Add initial migration 20241207000000_init with all database tables:
- monitored_addresses
- deposit_transactions
- block_checkpoints
- transaction_requests
- blockchain_events
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 09:08:31 -08:00
hailin
54d3533c18
feat(services): add infra-clean and infra-reset commands
...
- infra-clean: Remove infrastructure containers and volumes (DELETES DATA)
- infra-reset: Clean and reinstall infrastructure (DELETES DATA)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 08:56:36 -08:00
hailin
bfddd203ca
feat(services): add --no-cache option to rebuild-svc command
...
Usage: ./deploy.sh rebuild-svc <name> --no-cache
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 08:46:00 -08:00
hailin
fdb3c132de
feat(services): add infrastructure management commands to deploy.sh
...
Add commands for managing infrastructure services separately:
- infra-up: Start postgres, redis, zookeeper, kafka
- infra-down: Stop infrastructure services
- infra-restart: Restart infrastructure
- infra-status: Show infrastructure status with health checks
- infra-logs: View infrastructure service logs
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 08:32:30 -08:00
hailin
3dc0fb15d8
feat(blockchain-service): add Prisma migration for init schema
...
- Create migration 20241207000000_init with all 5 tables
- Tables: monitored_addresses, deposit_transactions, block_checkpoints, transaction_requests, blockchain_events
- Mark migration as applied to existing database
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 08:23:14 -08:00
hailin
0c00382a98
fix: convert deploy.sh CRLF to LF and add executable permission
...
- Convert Windows CRLF line endings to Unix LF for all deploy.sh files
- Add executable permission to all deploy.sh scripts
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 07:01:13 -08:00
hailin
b25a893d37
docs(config): update .env.example files for production deployment
...
- Update all .env.example files with production topology documentation
- Add network configuration for Server A (119.145.15.38/192.168.1.100) and Server B (192.168.1.111)
- Document service ports and connection URLs for all microservices
- Add architecture diagrams in comments for easy reference
- Include security notes and key generation commands
Files updated:
- backend/services/.env.example (main config)
- backend/services/identity-service/.env.example
- backend/services/mpc-service/.env.example
- backend/services/blockchain-service/.env.example
- backend/mpc-system/.env.example
- backend/api-gateway/.env.example
- backend/infrastructure/.env.example
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 04:55:21 -08:00
hailin
ab8852907d
fix(mpc-service): increase Kafka consumer session timeout
...
- Increase sessionTimeout from 30s to 5 minutes
- Increase heartbeatInterval from 3s to 10s
- Add rebalanceTimeout of 5 minutes
- This prevents consumer from being kicked out during long MPC keygen operations
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 03:58:40 -08:00
hailin
493a76117a
fix(identity-service): ensure BlockchainWalletHandler is initialized
...
- Add BlockchainEventConsumerService to InfrastructureModule
- Add BlockchainWalletHandler and MpcKeygenCompletedHandler to ApplicationModule
- Inject event handlers into UserApplicationService to force NestJS initialization
- This ensures onModuleInit is called for event handlers, enabling Kafka event consumption
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 03:46:55 -08:00
hailin
106137224a
fix(identity-service): add BlockchainEventConsumerService to InfrastructureModule
...
The consumer was not being initialized because it was not registered in the module.
2025-12-07 03:30:26 -08:00
hailin
bad6ba2232
fix(mpc-service): use @unique on username field for Prisma upsert compatibility
2025-12-07 02:19:17 -08:00
hailin
84e653d284
fix(mpc-service): add /api/v1 prefix to blockchain-service calls
...
blockchain-service uses global API prefix, need to include it in URLs.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:11:57 -08:00
hailin
845dd857b0
fix(mpc-service): add BLOCKCHAIN_SERVICE_URL config
...
Configure correct blockchain-service URL (port 3012) for address derivation.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:08:43 -08:00
hailin
3925b19229
fix(mpc-service): use JWT auth instead of X-API-Key
...
mpc-account-service expects JWT Bearer tokens, not X-API-Key header.
Added JWT token generation and use MPC_JWT_SECRET env var.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 02:02:17 -08:00
hailin
7588c9efb7
fix(mpc-service): use explicit container names for rwa services
...
When mpc-service joins mpc-system network, 'postgres' resolves to mpc-postgres.
Use explicit names (rwa-postgres, rwa-redis, rwa-kafka) to avoid conflicts.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:55:52 -08:00
hailin
63e543933f
fix(mpc-service): connect to mpc-system network
...
- Changed MPC URLs from 192.168.1.111 to Docker internal names
- Added mpc-system_mpc-network to mpc-service for cross-network communication
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:52:25 -08:00
hailin
2ae174692e
fix(mpc-service): use correct env var name MPC_ACCOUNT_SERVICE_URL
...
Changed from MPC_SYSTEM_URL to MPC_ACCOUNT_SERVICE_URL to match docker-compose config.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:48:02 -08:00
hailin
3332124250
fix(identity-service): change dynamic import to static import
...
Dynamic imports with path aliases (@/domain/events) don't work at runtime.
Changed to static import to fix module resolution error.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:40:46 -08:00
hailin
742cc21395
fix(identity-service): extend avatar_url column to 2000 chars
...
SVG avatars can be up to 745+ characters, exceeding the previous 500 char limit.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-07 01:31:44 -08:00
hailin
34fc008f9d
fix(blockchain-service): add global API prefix and increase healthcheck start_period
...
- Add app.setGlobalPrefix('api/v1') to main.ts so health endpoint
is at /api/v1/health consistent with other services
- Increase healthcheck start_period to 60s to allow time for
Prisma migrations on first startup
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 01:20:35 -08:00
hailin
be6abd3034
fix(blockchain-service): standardize Dockerfile with other services
...
- Use node:20-slim instead of alpine for OpenSSL compatibility
- Add startup script with prisma migrate/push
- Increase healthcheck start-period to 60s
- Add non-root user for security
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 01:17:55 -08:00
hailin
1125dd98ef
fix(blockchain-service): auto-create database and run migrations on startup
...
- Add rwa_blockchain to init-databases.sh script
- Change Dockerfile CMD to run prisma db push before starting app
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 01:14:50 -08:00
hailin
e20e3cb7af
fix(blockchain-service): add openssl and curl for Prisma and healthcheck
2025-12-07 01:09:25 -08:00
hailin
9eb2d5a206
fix(blockchain-service): import DomainModule for ConfirmationPolicyService
2025-12-07 01:06:45 -08:00
hailin
3af4234c89
feat: add blockchain-service to root docker-compose.yml
2025-12-07 00:58:23 -08:00
hailin
dba9d16074
.
2025-12-07 00:40:19 -08:00
hailin
6451cd6fc3
refactor: unify docker-compose configs to use shared infrastructure
...
All microservices now use the shared rwa-network and connect to:
- rwa-postgres: Shared PostgreSQL database server
- rwa-redis: Shared Redis cache
- rwa-kafka: Shared Kafka message broker
Each service's docker-compose.yml now only defines the application
container and uses `networks: external: true` to connect to the
shared infrastructure defined in the root docker-compose.yml.
This prevents duplicate infrastructure containers and ensures all
services can communicate via Kafka and share the same Redis/PostgreSQL.
Services updated:
- admin-service
- backup-service
- blockchain-service
- identity-service
- leaderboard-service
- mpc-service
- presence-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 00:35:56 -08:00
hailin
ce281b0657
fix(blockchain-service): install @scure/bip39 dependency
...
Add @scure/bip39 package for mnemonic-based address derivation.
Package.json already had the dependency listed but node_modules was missing it.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 00:25:27 -08:00
hailin
bbd8a701a8
fix(blockchain-service): add @scure/bip39 dependency
2025-12-07 00:20:49 -08:00
hailin
fcb949c799
fix(identity-service): remove WalletGeneratorService from app.module.ts
2025-12-07 00:15:08 -08:00
hailin
852073ae11
refactor: move mnemonic verification from identity-service to blockchain-service
...
- Add /internal/verify-mnemonic API to blockchain-service
- Add /internal/derive-from-mnemonic API to blockchain-service
- Create MnemonicDerivationAdapter for BIP39 mnemonic address derivation
- Create BlockchainClientService in identity-service to call blockchain-service
- Remove WalletGeneratorService from identity-service
- Update recover-by-mnemonic handler to use blockchain-service API
This enforces proper domain boundaries - all blockchain/crypto operations
are now handled by blockchain-service.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-07 00:11:06 -08:00
hailin
a181fd0d2d
fix(mpc-service): change healthcheck from wget to curl
...
Docker compose healthcheck was using wget which is not installed in the
node:20-slim image. Changed to use curl and corrected endpoint path.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:42:48 -08:00
hailin
5e93bbac33
fix(mpc-service): convert docker-entrypoint.sh line endings from CRLF to LF
2025-12-06 23:34:40 -08:00
hailin
54b9a66041
fix(backup-service): convert deploy.sh line endings from CRLF to LF
2025-12-06 23:29:58 -08:00
hailin
0ab1bf0dcc
feat(mpc-service): add blockchain-service client for address derivation
...
- Add BlockchainClientService to call blockchain-service /internal/derive-address
- Call derive addresses after keygen completes with MPC public key
- Include derived addresses (BSC, KAVA, DST) in keygen completed event
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:27:30 -08:00
hailin
cf308efecf
refactor(identity-service): remove deposit/blockchain code, belongs to wallet-service
...
- Remove DepositController, DepositService, BlockchainQueryService
- Deposit address and balance queries should be in wallet-service
- identity-service now only handles user identity
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:22:06 -08:00
hailin
9ae26d0f1f
refactor(identity-service): replace direct RPC with blockchain-service API calls
...
- Remove ethers.js direct RPC connection to blockchain
- Add HTTP client to call blockchain-service /balance API
- Add ConfigService for BLOCKCHAIN_SERVICE_URL configuration
- Enforce proper microservice boundaries
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 23:07:46 -08:00
hailin
383a9540a0
refactor: move backup-service client from identity-service to mpc-service
...
Architecture change: delegate share storage is now handled by mpc-service.
- identity-service no longer calls backup-service directly
- mpc-service calls backup-service after keygen completion
- This follows proper domain boundaries (MPC domain handles share storage)
Flow:
1. identity-service publishes mpc.KeygenRequested
2. mpc-service calls mpc-system for keygen
3. mpc-service stores delegate share to backup-service
4. mpc-service publishes mpc.KeygenCompleted
5. identity-service updates user wallet address
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 22:56:35 -08:00
hailin
f4f0466616
fix(mpc-service): convert deploy.sh line endings from CRLF to LF
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 22:45:35 -08:00
hailin
32c806b90c
fix(identity-service): add MpcEventConsumerService to app.module.ts
...
The InfrastructureModule was defined inline in app.module.ts, not using
the separate infrastructure.module.ts file. Added MpcEventConsumerService
to the inline module definition.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 22:36:01 -08:00
hailin
417f580df8
fix(identity-service): add MpcEventConsumerService to InfrastructureModule
...
Add missing MpcEventConsumerService provider to fix NestJS dependency injection error.
MpcClientService requires MpcEventConsumerService but it was not registered in the module.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 22:15:35 -08:00
hailin
10e4fa4a5f
fix(identity-service): convert deploy.sh line endings from CRLF to LF
...
Fix bash interpreter error caused by Windows-style CRLF line endings
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 22:03:46 -08:00
hailin
39804aa981
fix(mobile-app): update share link domain to rwaapi.szaiai.com
...
Changed invite share URLs from rwa-durian.app to rwaapi.szaiai.com
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 21:15:55 -08:00
hailin
2e815cec6e
feat: move address derivation from identity-service to blockchain-service
...
- Add Cosmos address derivation (bech32) to blockchain-service
- KAVA: kava1... format
- DST: dst1... format
- BSC: 0x... EVM format
- Create MpcEventConsumerService in blockchain-service to consume mpc.KeygenCompleted events
- Create BlockchainEventConsumerService in identity-service to consume blockchain.WalletAddressCreated events
- Simplify identity-service MpcKeygenCompletedHandler to only manage status updates
- Add CosmosAddress value object for Cosmos chain addresses
Event flow:
1. identity-service -> mpc.KeygenRequested
2. mpc-service -> mpc.KeygenCompleted (with publicKey)
3. blockchain-service consumes mpc.KeygenCompleted, derives addresses
4. blockchain-service -> blockchain.WalletAddressCreated (with all chain addresses)
5. identity-service consumes blockchain.WalletAddressCreated, saves to user account
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 21:08:21 -08:00
hailin
50388c1115
feat(blockchain-service): implement complete blockchain service with DDD + Hexagonal architecture
...
- Domain layer: ChainType, EvmAddress, TxHash, TokenAmount, BlockNumber value objects
- Domain events: DepositDetected, DepositConfirmed, WalletAddressCreated, TransactionBroadcasted
- Aggregates: DepositTransaction, MonitoredAddress, TransactionRequest
- Infrastructure: Prisma ORM, Redis cache, Kafka messaging, EVM blockchain adapters
- Application services: AddressDerivation, DepositDetection, BalanceQuery
- API: Health, Balance, Internal controllers with Swagger documentation
- Deployment: Docker, docker-compose, deploy.sh, health-check scripts
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 20:54:58 -08:00
hailin
6150617c14
docs: update blockchain-service guide with address derivation responsibilities
...
- Add public key → address derivation as primary responsibility
- Add AddressDerivationAdapter for EVM/Cosmos address derivation
- Add WalletAddressCreated event definition
- Add MPC event consumption (mpc.KeygenCompleted)
- Add MpcKeygenCompletedHandler for processing keygen events
- Add section 17: MPC integration event flow with diagrams
- Update document version to 1.2.0
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 20:02:50 -08:00
hailin
23043d5d79
feat: add detailed debug logging for MPC Kafka event flow
...
- Add comprehensive [INIT], [CONNECT], [PUBLISH], [RECEIVE], [HANDLE] logs
to identity-service and mpc-service Kafka services
- Add KeygenStarted event for tracking keygen progress
- Add MpcKeygenCompletedHandler to process keygen completion events
- Fix topic routing for MPC events between services
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 19:49:06 -08:00
hailin
289691dc3c
fix: align mpc-service migration with schema and fix identity-service compile errors
...
- Update mpc-service migration to match new gateway mode schema (mpc_wallets, mpc_shares)
- Remove old MySQL migrations (party_shares, session_states, share_backups)
- Fix MpcSignature type to use string format (64 bytes hex: R + S)
- Add persistence layer conversion functions for DB compatibility
- Fix method names in domain services (checkDeviceNotRegistered, generateNextUserSequence)
- Update wallet generator interface to use delegateShare instead of clientShareData
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 18:42:48 -08:00
hailin
ba91a89b16
feat(wallet-service): add Redis caching for wallet queries
...
- Add ioredis dependency for Redis connectivity
- Create Redis service and module with DB 1 configuration
- Implement WalletCacheService for wallet data caching (60s TTL)
- Integrate cache-aside pattern in getMyWallet query
- Add cache invalidation on all wallet mutations:
- handleDeposit, deductForPlanting, addRewards
- claimRewards, settleRewards
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 18:37:13 -08:00
hailin
c459387c42
feat: add event-driven communication between identity-service and mpc-service
...
Replace synchronous HTTP polling with Kafka event-driven model for MPC operations:
- Add MPC event consumer service in mpc-service for keygen/signing requests
- Add keygen-requested and signing-requested event handlers
- Add MPC event consumer in identity-service for completion events
- Extend mpc-client.service with async event-driven methods
- Support backward compatibility via MPC_USE_EVENT_DRIVEN env var
Topics: mpc.KeygenRequested, mpc.SigningRequested, mpc.KeygenCompleted,
mpc.SigningCompleted, mpc.SessionFailed
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 18:17:44 -08:00
hailin
17fd663fe3
refactor: improve auto-create API semantics and use real device ID
...
Frontend (account_service.dart):
- Use Android ID instead of random UUID for deviceId
- Add DeviceHardwareInfo class with full hardware details
- Remove provinceCode/cityCode from CreateAccountRequest
- Simplify to: deviceId (required), deviceName (optional JSON), inviterReferralCode (optional)
Backend (identity-service):
- Rename validateDeviceId() to checkDeviceNotRegistered() for clarity
- Rename generateNext() to generateNextUserSequence() for semantics
- Update error message: "该设备已创建过账户"
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-06 18:05:11 -08:00
hailin
9c36e6772b
refactor: simplify mpc-service to gateway mode
...
mpc-service 重新定位为网关服务,转发请求到 mpc-system:
- 简化 Prisma schema:只保留 MpcWallet 和 MpcShare
- 添加 delegate share 存储(keygen 后保存用户的 share)
- 保留六边形架构结构,清理不再需要的实现
- 删除旧的 command handlers、queries、repository 实现
- 简化 infrastructure module,只保留 PrismaService
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 17:16:14 -08:00
hailin
d652f1d7a4
feat: add MPC coordinator service and keygen/signing API
...
- Add MPCController with keygen and sign endpoints
- Add MPCCoordinatorService to coordinate with mpc-system
- Add MpcWallet, MpcShare, MpcSession entities for data storage
- Update identity-service mpc-client to call mpc-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-06 16:03:17 -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
hailin
8ff26cb929
docs(services): add MPC integration verification report
...
- Add comprehensive MPC system verification documentation
- Document integration issues and solutions
- Include test results and API verification
2025-12-04 23:56:21 -08:00
Developer
c26a24b544
fix(mpc-service): 确保 keygen 会话包含完整的参与者列表
...
问题:account-service 要求 participants 数量必须等于 threshold_n
原因:createKeygenSession 传入的 participants 可能不足 3 个
修复:
- 在 createKeygenSession 中自动补全参与者列表
- 对于 2-of-3 配置,确保有 3 个参与者:
- user-party (用户端)
- server-party-1 (服务端)
- server-party-2 (备份)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 06:04:47 -08:00
Developer
e23af5d4ad
fix(mpc-service): 添加 MPC_COORDINATOR_URL 和 MPC_MESSAGE_ROUTER_WS_URL 配置
...
问题:mpc-service 的 MPCCoordinatorClient 需要 MPC_COORDINATOR_URL 环境变量
原本只配置了 MPC_SESSION_COORDINATOR_URL,导致 Invalid URL 错误
修改内容:
- docker-compose.yml: 添加 MPC_COORDINATOR_URL 和 MPC_MESSAGE_ROUTER_WS_URL
- mpc-service/.env.example: 更新环境变量文档
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 05:55:26 -08:00
Developer
e4f9e4279f
fix(mpc-service): 硬编码 MPC_API_KEY 与 mpc-system 一致
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 05:37:12 -08:00
Developer
4db5534372
feat(mpc): 添加 server-party-api 服务,实现用户 share 生成
...
新增 mpc-system/services/server-party-api:
- 为 mpc-service 提供同步的 TSS keygen/signing API
- 参与 TSS 协议生成用户 share 并直接返回(不存储)
- 支持 API Key 认证
- 端口 8083 对外暴露
更新 mpc-service TSSWrapper:
- 改为调用 server-party-api 而非本地二进制
- 新增 MPC_SERVER_PARTY_API_URL 配置
- 超时时间调整为 10 分钟
架构: mpc-service -> account-service -> server-party-api -> TSS
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 05:32:41 -08:00
Developer
9dee0d36a5
feat(backup,mpc): 添加 prisma 迁移文件
...
backup-service 和 mpc-service 缺少 prisma/migrations 目录
导致 prisma migrate deploy 无法执行
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 04:01:47 -08:00
Developer
2fd784e3d2
fix(mpc-service): 使用标准 migrate deploy 替代 db push
...
移除 db push --accept-data-loss,改用 prisma migrate deploy
这是创建账号流程涉及的第3个服务(identity, backup, mpc)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 03:36:33 -08:00
Developer
6e53a4a572
fix(identity-service): 移除 db push 回退,只用 migrate deploy
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 03:33:58 -08:00
Developer
613d822c46
fix(backup-service): 添加 tsx 支持 Prisma 7 配置文件
...
- 安装 tsx 以便在生产环境运行 prisma.config.ts
- 复制 prisma.config.ts 到生产镜像
- 移除 --url 参数 (Prisma 7 不再支持)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 03:07:07 -08:00
Developer
9819661693
fix(backup-service): 移除 schema.prisma 中的 url (Prisma 7 配置在 prisma.config.ts)
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 02:39:57 -08:00
Developer
62eba58490
fix(backup-service): 添加 datasource url 到 Prisma schema
...
Prisma migrate/push 需要 datasource 中包含 url 属性。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 02:37:24 -08:00
Developer
f63606ce8f
feat(scripts): 添加数据库检查脚本
...
检查所有微服务的数据库和数据表是否已创建。
使用方法: ./scripts/check-databases.sh
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 02:35:29 -08:00
Developer
9e0adca3d3
fix(backup-service): 使用 printf 替代 echo 创建启动脚本
...
Alpine 的 sh 不支持 echo 的 \n 转义,改用 printf。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 02:32:07 -08:00
Developer
9898665506
feat(all-services): 添加数据库自动迁移到所有服务启动流程
...
在每个服务的 Dockerfile 中添加启动脚本:
- 服务启动前先执行 prisma migrate deploy
- 如果迁移失败则回退到 prisma db push
- 确保数据库表在服务启动时自动创建
修改的服务:
- identity-service
- wallet-service
- backup-service
- planting-service
- referral-service
- reward-service
- leaderboard-service
- reporting-service
- authorization-service
- admin-service
- presence-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 01:50:01 -08:00
Developer
f771dc8f6e
fix(presence-service): 修复 MetricsModule 依赖注入,直接提供仓库实现
...
MetricsCollectorService 需要 DAU 和 EventLog 仓库,
但这些在 InfrastructureModule 中通过符号注入,
导致循环依赖问题。改为在 MetricsModule 中直接提供这些依赖。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 01:35:59 -08:00
Developer
8faaedaa64
fix(presence-service): MetricsModule 导入 RedisModule 和 PersistenceModule
...
修复依赖注入错误: PresenceRedisRepository 和 DAU/EventLog 仓库无法解析
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 01:30:08 -08:00
Developer
43e769437f
fix(presence-service): 修复方法名 findByDay -> findByDate
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 00:53:04 -08:00
Developer
246c25ab8a
fix(presence-service): 同步 package-lock.json
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 00:05:46 -08:00
Developer
178a5c9f8b
feat(mpc-service): 实现混合传输模式 (WebSocket + HTTP轮询)
...
- 优先尝试 WebSocket 连接 (5秒超时)
- WebSocket 失败自动降级到 HTTP 轮询
- HTTP 轮询间隔 100ms,总超时 5分钟
- 新增 getTransportMode() 方法查看当前传输模式
- 修复 message-router 404 导致的 socket hang up 问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-04 00:00:49 -08:00
Developer
a701f55342
fix(mpc-service): 修复 WebSocket 导入方式
...
将 `import WebSocket from 'ws'` 改为 `import * as WebSocket from 'ws'`
以兼容 CommonJS 模块系统
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 22:58:00 -08:00
Developer
9363e4991f
fix(mpc-service): 使用 prisma db push 自动同步数据库 schema
...
- 容器启动时执行 prisma db push 自动创建/同步表结构
- 删除 migrations 目录,不再使用 migrate 机制
- 这是标准做法:schema.prisma 定义表结构,db push 同步到数据库
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:56:30 -08:00
Developer
8850ea6ab0
fix(mpc-service): 重构数据库迁移机制,从根本解决表不存在问题
...
问题分析:
- 旧迁移文件只有 party_shares 表,缺少 session_states 和 share_backups 表
- Prisma 的 _prisma_migrations 表记录迁移已完成,导致新表无法创建
- 迁移状态与实际数据库不一致
解决方案:
1. 删除旧迁移目录,创建全新的 0001_init 迁移
2. 新迁移包含所有三个表: party_shares, session_states, share_backups
3. 添加 docker-entrypoint.sh 启动脚本,容器启动时自动运行迁移
4. 修改 Dockerfile 使用 entrypoint 脚本
deploy.sh 新增命令:
- migrate-reset: 重置数据库并重新运行迁移
- migrate-push: 强制同步 schema (创建缺失的表)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:47:42 -08:00
Developer
122bf84c24
fix(mpc-service): 修复数据库迁移,添加缺失的表
...
migration.sql 与 schema.prisma 不同步,缺失以下表:
- session_states: 会话状态跟踪表
- share_backups: 分片备份表
同时修复了索引名称以匹配 schema 定义。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:32:36 -08:00
Developer
e51edc2ce4
fix(mpc-service): 修复 MPC 会话流程,先创建会话再加入
...
问题:mpc-service 尝试用 identity-service 生成的 SHA256 哈希作为
joinToken 加入会话,但 session-coordinator 期望的是由它自己
CreateSession 接口生成的 JWT token。
修复:
- coordinator-client.ts: 添加 createSession() 方法
- participate-keygen.handler.ts: 先创建会话获取 JWT,再加入
- participate-signing.handler.ts: 同上
- rotate-share.handler.ts: 同上(使用 keygen 类型)
流程变更:
1. CreateSession -> 获取 sessionId + JWT joinToken
2. JoinSession 使用 JWT token 加入会话
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:21:22 -08:00
Developer
467206fd61
fix(mpc-service): 修复 coordinator-client 请求/响应格式
...
session-coordinator 使用 camelCase JSON 格式:
请求:
- session_id, party_id, join_token -> joinToken, partyId
- 添加必需字段 deviceType, deviceId
响应:
- session_info.session_id -> sessionId
- other_parties -> participants
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:11:16 -08:00
Developer
e4abc7eb83
fix(mpc-service): 添加 /api/v1 前缀到 coordinator-client 路径
...
session-coordinator 的 API 路由注册在 /api/v1/sessions 下,
但 coordinator-client 调用的是 /sessions(404 错误)。
修复所有端点路径:
- /sessions/join -> /api/v1/sessions/join
- /sessions/report-completion -> /api/v1/sessions/report-completion
- /sessions/{id}/status -> /api/v1/sessions/{id}/status
- /sessions/report-failure -> /api/v1/sessions/report-failure
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 21:06:06 -08:00
Developer
cd4fba96ed
docs(blockchain-service): 完善架构设计以兼容其他微服务
...
- 添加 modules/ 分层模块文件结构 (api/application/domain/infrastructure)
- 抽取 AggregateRoot 聚合根基类,统一领域事件管理
- 补充 BlockNumber、TxHash 值对象的完整定义
- 添加值对象导出索引文件
- 新增第16章架构兼容性说明:
- 与其他服务的架构对比表
- 依赖倒置原则和六边形架构端口适配器说明
- 命名约定规范
- Symbol Token 注入规范
- 更新文档版本至 1.1.0
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 20:44:24 -08:00
Developer
08541f1d8d
fix(mpc): 修复 MPC 服务连接配置
...
问题: mpc-service 无法连接到 mpc-session-coordinator,超时 30 秒
修复:
1. mpc-system/docker-compose.yml:
- session-coordinator 暴露端口 8081:8080
- message-router 暴露端口 8082:8080
2. services/docker-compose.yml:
- MPC_COORDINATOR_URL: 192.168.1.100 -> 192.168.1.111
- MPC_MESSAGE_ROUTER_WS_URL: 192.168.1.100 -> 192.168.1.111
3. 同步更新 .env.example 和 deploy.sh
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 20:39:53 -08:00
Developer
84d619edf9
docs(blockchain-service): 添加区块链服务开发指南
...
- 定义 blockchain-service 领域边界和职责
- 设计 DDD + 六边形架构目录结构
- 设计 Prisma 数据模型 (MonitoredAddress, DepositTransaction, BlockCheckpoint, TransactionRequest)
- 设计领域层 (聚合根、值对象、领域事件、仓储接口)
- 设计基础设施层 (EVM Provider、事件监听器、区块扫描器、地址缓存)
- 设计应用层 (充值检测服务、余额查询服务)
- 定义 Kafka 事件和消费者
- 配置 Docker 部署和 Kong 路由
- 制定从 identity-service 迁移计划
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 20:23:56 -08:00
Developer
55d40c8200
fix(mpc-service): 改用 Debian slim 基础镜像
...
- 从 Alpine 改为 Debian slim (与 identity-service 一致)
- 使用 curl 进行健康检查
- 添加 DATABASE_URL 用于 Prisma generate
- 通过代理访问官方源
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 19:57:11 -08:00
Developer
e4172c11b9
fix(identity-service): 移除所有中国镜像配置,使用官方源+代理
...
- 移除 Alpine 镜像加速
- 移除 Debian 镜像加速
- 移除 npm 镜像加速
- 通过 Docker 代理访问官方源
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 19:34:56 -08:00
Developer
d18de9823f
fix(identity-service): 恢复使用 npmmirror 镜像
...
- 从华为云镜像回滚到 npmmirror
- 移除无效的 disturl 配置
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 19:11:07 -08:00
Developer
db8350b2f5
fix(identity-service): 更换 npm 镜像为华为云解决超时问题
...
- npmmirror CDN 超时 (EIDLETIMEOUT)
- 改用 mirrors.huaweicloud.com/repository/npm/
- 添加 disturl 配置加速 node 二进制下载
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:45:18 -08:00
Developer
eba8953e3a
perf(identity-service): 添加 Docker 构建镜像加速
...
- Alpine: 使用 mirrors.aliyun.com
- Debian: 使用 mirrors.aliyun.com
- npm: 使用 registry.npmmirror.com (淘宝镜像)
加速中国区 Docker 构建速度
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:19:39 -08:00
Developer
ef21009644
fix(identity-service): 修复 MPC keygen 请求参数
...
- sessionId 使用纯 UUID 格式(移除 mpc- 前缀)
- shareType 使用 'wallet' 匹配 PartyShareType 枚举
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:10:42 -08:00
Developer
e068b99dc1
fix(mpc-service): 将 keygen/signing 接口标记为 Public
...
临时解决 identity-service 调用 mpc-service 时的 401 认证错误:
- keygen/participate
- keygen/participate-sync
- signing/participate
- signing/participate-sync
TODO: 添加适当的服务间认证机制(API key 或 service JWT)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 18:05:31 -08:00
Developer
12032b905f
fix(identity-service): 修复 MPC 服务调用路径
...
问题: identity-service 调用 mpc-service 返回 404
原因: mpc-service 有全局前缀 /api/v1,但调用路径缺少此前缀
修复:
- mpc-client.service.ts: 添加 /api/v1 前缀到 MPC API 调用路径
- kong.yml: 添加 /api/v1/mpc-party 路由
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 16:49:49 -08:00
Developer
b8aa44bf74
feat(identity-service): 添加 Prisma 初始化迁移
...
添加数据库表结构迁移文件:
- user_accounts: 用户账户表
- user_devices: 用户设备表
- wallet_addresses: 钱包地址表
- account_sequence_generator: 账号序列生成器
- user_events: 用户事件表
- device_tokens: 设备令牌表
- dead_letter_events: 死信事件表
- sms_codes: 短信验证码表
- mpc_key_shares: MPC密钥分片表
- mpc_sessions: MPC会话表
- referral_links: 推荐链接表
执行方式: ./deploy.sh migrate
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 16:41:59 -08:00
Developer
9656a6f4c4
feat(presence-service): 添加 Prometheus 指标监控和 Grafana Dashboard
...
Prometheus 指标端点 (/api/v1/metrics):
- presence_online_users_total: 实时在线人数
- presence_dau_total: 今日 DAU
- presence_heartbeat_total: 心跳计数
- presence_events_received_total: 事件上报计数
- presence_session_start_total: 会话开始计数
- presence_heartbeat_duration_seconds: 心跳处理延迟
- presence_event_batch_duration_seconds: 事件批处理延迟
Grafana Dashboard:
- 核心指标概览 (在线人数、DAU、心跳、事件)
- 趋势图表 (在线人数趋势、心跳/事件速率)
- 事件分布 (饼图、按小时趋势)
- 性能指标 (P50/P95/P99 延迟)
- 服务资源 (内存、CPU)
配置更新:
- prometheus.yml 添加 presence-service 抓取配置
- package.json 添加 prom-client 依赖
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 08:38:05 -08:00
Developer
114a9e611c
fix(admin-service): 修复 APK 解析 - 使用临时文件代替 Buffer
...
adbkit-apkreader 库只支持文件路径,不支持 Buffer
现在先将 Buffer 写入临时文件,解析后删除
参考: https://github.com/openstf/adbkit-apkreader
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 08:22:14 -08:00
Developer
b1bee7f44e
fix(admin-service): 修复 adbkit-apkreader 模块导入问题
...
使用 require() 代替 ES Module 导入,解决 'Cannot read properties of undefined' 错误
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 08:19:39 -08:00
Developer
f8607ce0b2
feat: 增强移动端版本管理功能
...
## admin-service
- 添加 APK/IPA 预解析 API (/api/v1/versions/parse)
- 添加断点续传下载控制器 (/api/v1/downloads/:filename)
- 配置 uploads volume 持久化存储
- 下载 URL 从 /uploads 改为 /downloads (支持 Range 请求)
## mobile-upgrade (前端)
- 上传文件后自动解析并填充版本信息
- 添加 ParsedPackageInfo 类型和 parsePackage API
## mobile-app (Flutter)
- DownloadManager 支持断点续传 (HTTP Range)
- 添加临时文件管理和清理功能
- 添加构建脚本自动增加版本号 (scripts/build.sh)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:57:26 -08:00
Developer
d55a2673dc
fix(admin-service): 修复 APK 解析模块的 TypeScript 编译错误
...
- 修改 adbkit-apkreader 的 import 语法为 default export
- 更新类型声明文件支持 default export 模式
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:52:18 -08:00
Developer
f9deca5df0
feat(admin-service): 增强移动端版本上传功能
...
- 添加 APK/IPA 文件解析器自动提取版本信息
- 支持从安装包自动读取 versionName 和 versionCode
- 添加 adbkit-apkreader 依赖解析 APK 文件
- 添加 plist 依赖解析 IPA 文件
- 优化上传接口支持自动填充版本信息
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:39:36 -08:00
Developer
de2e2d0428
refactor(api-gateway): 将 Kong 独立为解耦模块
...
- 将 Kong 从 services/docker-compose.yml 移到 api-gateway/docker-compose.yml
- 添加 api-gateway/deploy.sh 一键部署脚本
- 完善 api-gateway/README.md 文档,包含完整架构图和部署流程
- Kong 使用外部网络连接 services,实现解耦部署
架构变更:
- services: 只包含微服务,不依赖 Kong
- api-gateway: 独立的 Kong 网关,可选部署
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 00:38:49 -08:00
Developer
7d9d5eeffe
feat(api-gateway): 添加 Kong API 网关和 Nginx 配置
...
- 添加 Kong 声明式配置 (kong.yml),定义所有微服务路由
- 更新 docker-compose.yml 添加 Kong 服务 (kong-db, kong-migrations, kong)
- 添加 rwaapi.szaiai.com Nginx 配置 (SSL + 反向代理到 Kong)
- 添加 nginx/install.sh 一键安装脚本
- 添加 API Gateway README 文档
架构: 用户 → Nginx (SSL) → Kong (API Gateway) → 各微服务
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 00:33:22 -08:00
Developer
46379afd18
fix(deploy): 添加 admin-service 数据库 rwa_admin
...
- 在 init-databases.sh 中添加 rwa_admin 数据库
- 在 migrate 函数中添加 admin-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:57:55 -08:00
Developer
e03b9eb7c9
feat(deploy): 添加 presence-service 到主部署脚本
...
- 在 init-databases.sh 中添加 rwa_presence 数据库
- 在 migrate 函数中添加 presence-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:56:15 -08:00
Developer
aa06607c1d
feat(presence-service): 添加 init-db 命令创建数据库
...
- 添加 init-db 命令自动创建 rwa_presence 数据库
- 创建数据库后自动运行 prisma db push 创建表结构
- 更新帮助文档
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:53:49 -08:00
Developer
784e98f1dc
fix(deploy): 修复 health 命令使用正确的健康检查端点
...
- 为每个微服务配置实际的健康检查端点路径
- 大多数服务使用 /api/v1/health
- backup-service 和 reward-service 使用 /health
- leaderboard-service 使用 /api/health
- 新增 presence-service (端口 3011)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:46:52 -08:00
Developer
fcd97f26cf
fix(presence-service): 添加 --no-deps 避免重启已运行的基础设施
...
deploy.sh start/up 命令添加 --no-deps 选项,防止在启动
presence-service 时重新创建已经运行的共享基础设施容器
(postgres, redis, kafka)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:19:40 -08:00
Developer
086d82f98a
feat(admin-service): 添加 init-db 命令自动创建数据库
...
用法: ./deploy.sh init-db
- 自动创建 rwa_admin 数据库(如不存在)
- 自动运行 Prisma 迁移
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:02:41 -08:00
Developer
6f55dc3195
fix(admin-service): 排除移动端API路由的全局前缀
...
移动端APP需要访问 /api/app/version/check,而不是 /api/v1/api/app/version/check
使用 setGlobalPrefix 的 exclude 选项排除移动端路由
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:50:04 -08:00
Developer
8a57013596
feat(admin-service): 实现完整的移动端版本管理和升级服务
...
- 添加版本CRUD API:list, get, update, delete, toggle
- 添加文件上传支持:APK/IPA文件上传并计算SHA256校验
- 新增移动端专用API endpoint: /api/app/version/check
- 修复deploy.sh自调用权限问题(使用绝对路径)
- 添加完整的技术文档 APP_UPGRADE_SERVICE.md
新增文件:
- MobileVersionController: 移动端兼容的版本检查接口
- FileStorageService: 文件上传和存储服务
- CQRS handlers: ListVersions, GetVersion, UpdateVersion, DeleteVersion, ToggleVersion, UploadVersion
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:31:36 -08:00
Developer
c3f4243e81
fix(presence-service): 修复 deploy.sh 自调用权限问题
...
使用 bash "$SCRIPT_DIR/deploy.sh" 替代 $0 避免路径变化导致的权限问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:26:19 -08:00
Developer
893399e07f
refactor(infra): 统一微服务基础设施为共享模式
...
- 将 presence-service 添加到主 docker-compose.yml(端口 3011,Redis DB 10)
- 更新 init-databases.sh 添加 rwa_admin 和 rwa_presence 数据库
- 重构 admin-service/deploy.sh 使用共享基础设施
- 重构 presence-service/deploy.sh 使用共享基础设施
- 添加 authorization-service 开发指南文档
解决多个微服务独立启动重复基础设施(PostgreSQL/Redis/Kafka)的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:46:50 -08:00
Developer
d6227a574b
refactor(presence-service): 优化 deploy.sh 与主基础设施集成
...
- 更新容器名和镜像名与项目规范一致
- 添加 load_env 函数支持共享环境配置
- 添加 up/logs-all/clean-all 命令
- 使用动态 HEALTH_ENDPOINT
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:45:28 -08:00
Developer
f132b86899
feat(presence-service): 添加完整的部署脚本
...
- 添加 deploy.sh 主部署脚本 (build/start/stop/logs/migrate/test)
- 添加 scripts/quick-test.sh API 快速测试脚本
- 添加 scripts/rebuild-kafka.sh Kafka 重建脚本
- 更新 scripts/README.md 文档
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:16:33 -08:00
Developer
603c1c6c90
feat(presence-service): 添加完整的测试套件和生产部署设施
...
- 添加 165 个测试用例 (123 单元测试, 22 集成测试, 20 E2E测试)
- 添加 Docker 多阶段构建和 docker-compose 生产部署配置
- 添加完整的文档体系 (架构、API、开发、测试、部署)
- 添加环境配置 (.env.development/production/test)
- 添加部署脚本 (health-check, start-all, stop-service)
- 修复 TypeScript 类型错误
- 经 WSL2 验证所有生产部署命令测试通过
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:10:04 -08:00
Developer
37c255bdc1
fix(admin-service): 修复TypeScript编译错误
...
- 修复 version.controller.ts 中 FileSize 使用 .bytes 替代 .value
- 修复测试文件中 AppVersion.create 缺少 isForceUpdate 参数
- 修复测试文件中使用正确的 Prisma Platform 枚举类型
- 修复 CreateVersionCommand 参数顺序错误
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:01:08 -08:00
Developer
eae1350f35
feat(admin-service): 添加完整的量产部署设施
...
参考 identity-service 的部署配置,为 admin-service 添加:
新增文件:
- .dockerignore: Docker 构建排除配置
- .env.development: 开发环境配置
- .env.production: 生产环境配置(使用变量引用)
- docker-compose.yml: 完整的 Docker 编排(含 PostgreSQL, Redis)
更新文件:
- deploy.sh: 增强部署脚本,新增 30+ 命令(健康检查、测试、清理等)
- docs/DEPLOYMENT.md: 整合快速开始指南和命令速查表
服务架构:
- admin-service: 端口 3010
- PostgreSQL: 端口 5433(避免冲突)
- Redis: 端口 6380(避免冲突)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 19:34:31 -08:00
Developer
79e2b9bfdd
docs(admin-service): 添加完整的技术文档体系
...
文档结构:
- docs/ARCHITECTURE.md: DDD+Hexagonal 架构设计详解
- docs/API.md: RESTful API 完整接口文档
- docs/DEVELOPMENT.md: 开发环境设置和代码规范
- docs/TESTING.md: 三层测试架构 (Unit/Integration/E2E)
- docs/DEPLOYMENT.md: 本地/Docker/生产环境部署指南
- docs/README.md: 文档中心导航和快速入门
架构文档 (ARCHITECTURE.md):
- 服务职责和核心功能说明
- DDD 领域模型 (聚合根、值对象、领域服务)
- 六边形架构分层设计
- 数据流和依赖方向详解
- SOLID 原则应用示例
- 性能优化和安全性考量
API 文档 (API.md):
- 6 个核心 API 端点完整说明
- 请求/响应格式和数据模型
- 错误处理和状态码规范
- cURL/Postman 使用示例
- 版本控制和更新策略
- 最佳实践和常见问题
开发文档 (DEVELOPMENT.md):
- VSCode 配置和推荐插件
- 本地环境初始化步骤
- Git 工作流和 Commit 规范
- 完整开发迭代流程示例
- TypeScript/DDD/NestJS/Prisma 代码规范
- 调试技巧和常见开发任务
测试文档 (TESTING.md):
- 测试金字塔三层架构 (53+21+15=89 测试用例)
- 本地/WSL2/Docker 测试环境设置
- 单元/集成/E2E 测试详细示例
- Make/npm 脚本快速执行
- 覆盖率目标和 CI/CD 集成
- GitHub Actions 配置示例
部署文档 (DEPLOYMENT.md):
- 部署架构和系统要求
- Ubuntu 服务器环境准备
- PM2 本地部署流程
- Docker Compose 容器化部署
- Nginx 反向代理和 SSL 配置
- 数据库备份和日志管理
- 监控告警和故障排查
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 19:01:12 -08:00
Developer
f8c9c579f2
feat(admin-service): 添加 database 目录和初始化脚本
...
新增目录和文件:
- database/init.sql: 数据库初始化脚本(保留用于未来需求)
- database/README.md: database 目录使用说明文档
database/ 目录用途:
1. 存放数据库初始化SQL脚本
2. 在Prisma migrations之后执行
3. 用于插入初始数据或设置序列号等
与Prisma的关系:
- Prisma migrations: 创建表结构
- database/init.sql: 插入初始数据
Docker Compose集成:
可通过volume映射到/docker-entrypoint-initdb.d/自动执行
参考其他服务:
- identity-service: 使用init.sql初始化序列号生成器
- mpc-service: 使用database/migrations存放迁移
当前状态:
- init.sql已创建但为空(目前不需要初始数据)
- 完整文档说明用途和使用方法
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 18:42:33 -08:00
Developer
dd25ff5659
docs(admin-service): 添加测试执行结果文档
...
测试结果总结:
✅ 测试基础设施: 完全就绪
✅ 数据库: PostgreSQL容器运行成功
✅ 迁移: Prisma迁移成功应用
✅ 测试代码: 9个文件,~89个用例
✅ 文档: 4个完整文档
测试覆盖:
- 单元测试: 6个文件(Value Objects/Entities/Mappers)
- 集成测试: 2个文件(Repository/Handlers)
- E2E测试: 1个文件(Controllers)
环境验证:
✅ WSL2 + Docker
✅ PostgreSQL 16
✅ Prisma迁移成功
✅ 测试框架配置正确
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 18:34:21 -08:00
Developer
1e4e9dc342
docs(admin-service): 添加完整测试执行指南和数据库测试脚本
...
新增文件:
- TEST_EXECUTION_GUIDE.md: 完整的测试执行指南
- 三层测试说明(单元/集成/E2E)
- 数据库依赖说明
- 多种测试执行方法(本地/WSL2/Docker)
- 常见问题排查
- CI/CD 配置示例
- scripts/test-with-docker-db.sh: WSL2完整测试脚本
- 自动启动PostgreSQL容器
- 运行所有测试层级
- 生成覆盖率报告
- 自动清理
测试层级说明:
✅ 单元测试: 不需要数据库(Value Objects/Entities/Mappers)
✅ 集成测试: 需要数据库(Repository/Handlers)
✅ E2E测试: 需要数据库(Controllers/API)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 18:23:18 -08:00
Developer
ce1f4ff9f9
test(admin-service): 添加完整的自动化测试框架
...
测试框架特性:
- Jest + TypeScript + ts-jest 配置
- 三层测试架构: 单元/集成/E2E
- 完整的 DDD 测试覆盖
单元测试 (test/unit/):
✅ Value Objects 测试 (4个文件)
- version-code.vo.spec.ts: 版本号验证和比较
- version-name.vo.spec.ts: 语义化版本格式
- file-size.vo.spec.ts: 文件大小验证和格式化
- file-sha256.vo.spec.ts: SHA256哈希验证
✅ Entity 测试
- app-version.entity.spec.ts: 实体创建、业务方法、查询方法
✅ Mapper 测试
- app-version.mapper.spec.ts: 领域-持久化转换
集成测试 (test/integration/):
✅ Repository 测试
- app-version.repository.spec.ts: CRUD操作、查询方法
✅ Handler 测试
- create-version.handler.spec.ts: 命令处理器测试
E2E 测试 (test/e2e/):
✅ Controller 测试
- version.controller.spec.ts: API端点、输入验证、错误处理
测试工具和配置:
- Makefile: make test, test-unit, test-integration, test-e2e, test-cov
- Docker测试: Dockerfile.test + docker-compose.test.yml
- WSL2测试: run-wsl-tests.ps1 + test-in-wsl.sh
- 测试环境: .env.test
- package.json: Jest配置 + 测试脚本
文档:
- TEST_GUIDE.md: 详细测试指南
- TESTING_SUMMARY.md: 测试总结
测试统计:
- 9个测试文件
- ~100个测试用例
- 覆盖Value Objects/Entities/Mappers/Repositories/Handlers/Controllers
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 18:15:59 -08:00
Developer
3385997b86
refactor(admin-service): 完全按DDD架构重构,添加值对象层
...
值对象层 (Value Objects):
- VersionCode: 整数版本号,支持比较操作
- VersionName: 语义化版本格式 (major.minor.patch)
- BuildNumber: 构建号验证 (字母数字+点/下划线/连字符)
- DownloadUrl: HTTP/HTTPS URL 格式验证
- FileSha256: 64字符十六进制字符串验证
- FileSize: BigInt类型,2GB上限,支持人类可读格式转换
- Changelog: 更新日志 (10-5000字符)
- MinOsVersion: 最低操作系统版本格式验证
领域层重构:
- AppVersion Entity: 从贫血模型重构为充血模型
- 私有字段 + getter 封装
- 业务方法: disable(), enable(), setForceUpdate(), setReleaseDate()
- 工厂方法: create() (新建), reconstitute() (重建)
- 使用值对象替代所有原始类型
基础设施层:
- AppVersionMapper: 领域对象与持久化模型转换
- AppVersionRepositoryImpl: 使用 Mapper 进行数据转换
- 更新方法签名使用值对象类型
应用层:
- CreateVersionHandler: 创建值对象后构建领域实体
- CheckUpdateHandler: 从值对象提取值用于响应
共享层:
- DomainException: 领域异常基类
架构改进:
- 完整的 DDD 分层架构
- 值对象封装验证逻辑和业务规则
- 领域实体包含业务行为
- 清晰的领域-持久化边界
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 17:33:32 -08:00
Developer
0be3fe619e
feat(presence-service): 完整实现 DDD+Hexagonal 架构的用户活跃度与在线状态服务
...
Domain 层 (领域层):
- 值对象: InstallId, EventName, EventProperties, DeviceInfo, TimeWindow
- 实体: EventLog, OnlineSnapshot
- 聚合根: DailyActiveStats
- 领域事件: SessionStartedEvent, HeartbeatReceivedEvent, DauCalculatedEvent
- 仓储接口: IEventLogRepository, IDailyActiveStatsRepository, IOnlineSnapshotRepository
- 领域服务: DauCalculationService, OnlineDetectionService
Infrastructure 层 (基础设施层):
- Prisma: EventLog, DailyActiveStats, OnlineSnapshot 数据模型
- Redis: 在线状态存储 (ZSET) + HyperLogLog DAU 实时统计
- Kafka: 事件发布服务 (可选)
- Mappers: 领域对象 <-> Prisma 模型转换
- 仓储实现: EventLogRepositoryImpl, DailyActiveStatsRepositoryImpl, OnlineSnapshotRepositoryImpl
Application 层 (应用层):
- Commands: RecordEvents, RecordHeartbeat, CalculateDau
- Queries: GetOnlineCount, GetDauStats
- Schedulers: 每分钟记录在线快照, 每小时清理过期数据, 每天凌晨计算前一天DAU
API 层 (表现层):
- Controllers: AnalyticsController, PresenceController, HealthController
- DTOs: BatchEventsDto, HeartbeatDto, QueryDauDto, OnlineCountResponseDto, DauStatsResponseDto
- Guards: JwtAuthGuard
- Decorators: @Public, @CurrentUser
核心功能:
- ✅ 用户行为事件批量上报与存储
- ✅ 日活 DAU 统计 (按自然日去重, 支持省/市维度)
- ✅ 实时在线人数统计 (3分钟窗口)
- ✅ 心跳机制 (前台60秒间隔)
- ✅ HyperLogLog 实时 DAU 计数
- ✅ 定时任务 (快照记录, 过期清理, DAU 计算)
- ✅ Swagger API 文档
- ✅ Docker 多阶段构建
- ✅ 健康检查
技术栈:
- NestJS + TypeScript
- Prisma ORM + PostgreSQL
- Redis (ioredis)
- Kafka (kafkajs, 可选)
- CQRS 模式 (@nestjs/cqrs)
- 定时任务 (@nestjs/schedule)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 12:11:38 -08:00
hailin
996bc231f2
.
2025-12-03 03:51:47 +08:00
Developer
566f464a9b
wip(presence-service): 初始化项目结构
...
- 创建基础配置文件 (package.json, tsconfig.json, nest-cli.json)
- 设计 Prisma schema (heartbeats, daily_active_users, online_sessions, dau_statistics)
- 待完善: Domain/Infrastructure/Application/API层实现
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 11:47:14 -08:00
Developer
c45ed8a575
feat(admin-service): 实现移动应用版本管理服务
...
- DDD+Hexagonal架构
- Domain层: AppVersion实体, Platform枚举, Repository接口
- Infrastructure层: Prisma集成, Repository实现
- Application层: CheckUpdate查询(供移动端), CreateVersion命令(管理员)
- API层: VersionController, DTOs (request/response)
- 数据库: app_versions表设计(支持Android/iOS)
- 功能: 版本检查、强制更新、文件SHA-256校验
- 部署: Dockerfile, docker-compose.yml, deploy.sh脚本
- 数据库迁移: Prisma migration初始化
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 11:22:30 -08:00
Developer
abe6d02a4c
fix(planting-service): 修复 CMD 路径并统一使用 curl
2025-12-02 11:06:13 -08:00
Developer
f3ac5d3718
fix: 修复健康检查路径,添加 authorization-service 健康检查控制器
2025-12-02 10:59:49 -08:00
Developer
99589f666a
fix(authorization-service): 修复端口配置默认值为 3009
2025-12-02 10:48:33 -08:00
Developer
24c7be6a8d
fix(referral-service): 修复端口配置使用 APP_PORT
2025-12-02 10:47:46 -08:00
Developer
d5e7da4828
fix(authorization-service): 修复 CMD 路径、端口号并安装 curl
2025-12-02 10:41:41 -08:00
Developer
f1b6370aae
fix(referral-service): 统一使用 curl 进行健康检查
2025-12-02 10:39:36 -08:00
Developer
b5d097214b
fix(referral-service): 统一健康检查使用 wget
...
docker-compose.yml: curl -> wget (与 Dockerfile 一致)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:35:47 -08:00
Developer
00e359b412
fix(mpc-service): 直接从环境变量读取配置
...
ConfigService.get('port') 读取不到嵌套配置
改为直接使用 process.env.APP_PORT
修复服务监听错误端口 (6379 -> 3006)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:29:59 -08:00
Developer
62dcc37b28
fix(backup-service): 添加 DATABASE_URL 用于 Prisma generate
...
构建时需要 dummy DATABASE_URL
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:17:43 -08:00
Developer
a17ac1b06a
fix(mpc-service): 使用 openssl 包替代 openssl1.1-compat
...
Alpine 3.22 已移除 openssl1.1-compat
使用 openssl (OpenSSL 3) 替代
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:17:08 -08:00
Developer
b67a5434e2
fix(mpc-service): 安装 OpenSSL 1.1 修复 Prisma 引擎加载失败
...
错误: libssl.so.1.1: No such file or directory
解决: 在 production stage 安装 openssl1.1-compat
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:14:36 -08:00
Developer
2297be1a04
fix(docker-compose): 统一 backup-service 和 mpc-service 健康检查
...
backup-service:
- docker-compose.yml: curl -> wget (与 Dockerfile 一致)
mpc-service:
- docker-compose.yml: curl -> node HTTP (与 Dockerfile 一致)
修复 docker-compose healthcheck 覆盖 Dockerfile HEALTHCHECK 导致的不一致
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:13:34 -08:00
Developer
9088b1a9ee
fix(backup-service): 修正启动路径和健康检查等待时间
...
- start-period: 5s -> 40s (给予足够启动时间)
- CMD: dist/main.js -> dist/src/main.js (修正实际路径)
- 保持使用 wget (Alpine 原生支持)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:11:37 -08:00
Developer
781619e2ff
revert: 恢复 backup-service 和 mpc-service 原始 Dockerfile
...
回滚到纯 Alpine 版本(最初可用的版本)
- backup-service: 66199cc
- mpc-service: 6fa4d7a
之前的修改(slim/openssl/curl)导致问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:10:22 -08:00
Developer
0388aee2d4
fix(backup-service): 修复 builder stage 使用 Alpine 导致 Prisma 失败
...
问题:
- Builder stage 使用 node:20-alpine
- Prisma 在 Alpine 上下载二进制文件时网络错误
- linux-musl-openssl 兼容性问题
解决:
- Builder 和 Production 都使用 node:20-slim
- 统一使用 Debian base image
- 在 builder stage 安装 OpenSSL
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:07:05 -08:00
Developer
451aa8fae8
feat(mpc-service): 添加初始数据库 migration
...
创建 party_shares 和 signing_sessions 表及索引
修复健康检查失败问题(缺少数据库表)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 10:03:03 -08:00
Developer
53943636ea
fix(backup-service): 修复健康检查配置不一致问题
...
- 将 Dockerfile 从 wget 改为 curl
- 统一 Dockerfile 和 docker-compose.yml 健康检查工具
- 增加 start_period 从 5s 到 40s,给予服务更多启动时间
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:57:32 -08:00
Developer
17ff0d951e
fix: 修复 docker-compose.yml 中所有服务的健康检查
...
问题:
- docker-compose.yml 的 healthcheck 覆盖了 Dockerfile 的 HEALTHCHECK
- 使用 wget 而不是 curl
- 健康检查 URL 不正确,导致所有服务显示 unhealthy
修复:
1. 统一使用 curl -f 代替 wget
2. 修正所有服务的健康检查 URL:
- identity-service: /health → /api/v1/health
- wallet-service: /health → /api/v1/health
- backup-service: /health ✓ (保持不变)
- planting-service: /health → /api/v1/health
- referral-service: /health ✓ (保持不变)
- reward-service: /health ✓ (保持不变)
- mpc-service: /api/v1/health ✓ (已正确,改用 curl)
- leaderboard-service: /health → /api/health
- reporting-service: /health → /api/v1/health
- authorization-service: /health ✓ (保持不变,改用 curl)
3. 统一 timeout 为 3s (原来是 10s)
4. admin-web: 优化 timeout 为 3s
Docker HEALTHCHECK 机制:
- 在容器内部执行 curl localhost:PORT/path
- 不经过 Nginx 或外部网络
- 需要与服务实际端点匹配
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:36:38 -08:00
Developer
ace7145b4c
fix(reward-service): 修复 DI 依赖注入错误
...
问题: RewardCalculationService 无法解析依赖
- DomainModule 未导入 InfrastructureModule
- service clients 使用 useClass 导致创建新实例时缺少依赖
解决方案:
1. DomainModule 导入 InfrastructureModule
2. InfrastructureModule 中:
- 先注册具体的 client 类 (ReferralServiceClient, AuthorizationServiceClient)
- 然后用 useExisting 提供 token 别名
- 这样确保使用同一个实例,包含所有依赖
参考: leaderboard-service 的修复方案
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:24:12 -08:00
Developer
afdaa888ec
refactor: 将所有服务的健康检查从 wget 改为 curl
...
curl 相比 wget 的优势:
- 更轻量 (二进制文件更小)
- 更常用 (标准 HTTP 工具)
- 语法更简洁 (curl -f vs wget -q --spider)
- 退出码更可靠 (-f 参数在 HTTP 错误时返回非 0)
修改的服务:
- identity-service
- wallet-service
- mpc-service
- reward-service
- leaderboard-service
- reporting-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:19:35 -08:00
Developer
5870614838
fix(reward-service): 修复 Prisma schema 缺少 url 字段
...
添加 datasource url 配置,解决构建时 Prisma generate 失败
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 09:14:43 -08:00
Developer
3c00f71f88
chore(reward-service): 重新生成 package-lock.json
...
使用 Prisma 5.22.0 版本重新生成 package-lock.json
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:47:09 -08:00
Developer
8fe4f651dc
fix(reporting-service): 修复 Dockerfile 构建和健康检查
...
- builder 阶段从 alpine 改为 slim (解决 Prisma 兼容性)
- 添加 OpenSSL 依赖到 builder 阶段
- 添加构建验证步骤
- 修复健康检查 URL: /health → /api/v1/health
- 添加 NODE_ENV=production
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:44:36 -08:00
Developer
86e7d5a3fa
fix(reward-service): 降级 Prisma 版本 7.x → 5.22.0
...
修复 PrismaClient 初始化错误:
TypeError: Cannot read properties of undefined (reading '__internal')
Prisma 7.x 是预览版本,存在兼容性问题,降级到稳定的 5.22.0 版本。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:42:53 -08:00
Developer
451185005f
fix: 修复多个服务的 Docker 健康检查和构建配置
...
identity-service:
- 修复 HEALTHCHECK URL: /health → /api/v1/health
wallet-service:
- 修复 HEALTHCHECK URL: /health → /api/v1/health
leaderboard-service:
- 修复端口: 3000 → 3007
- 添加 HEALTHCHECK (/api/health)
- 添加非 root 用户 (nestjs)
- 添加 NODE_ENV=production
mpc-service:
- builder 阶段从 alpine 改为 slim (解决 Prisma 兼容性)
- 添加 OpenSSL 依赖到 builder 阶段
- 添加 wget 依赖
- HEALTHCHECK 从 node 脚本改为 wget
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:33:33 -08:00
Developer
4bd25d4e3c
feat(leaderboard-service): 添加 Prisma 初始 migration
...
- 创建 leaderboard_rankings 表
- 创建 leaderboard_configs 表
- 创建 virtual_accounts 表
- 创建 virtual_ranking_entries 表
- 创建 leaderboard_snapshots 表
- 创建 virtual_account_transactions 表
- 创建 leaderboard_events 表
- 插入默认配置数据
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:23:43 -08:00
Developer
bb989bd80f
fix(reward-service): 修复 Dockerfile 使用 Debian slim 和正确的 CMD 路径
...
- Builder 阶段从 node:20-alpine 改为 node:20-slim
- 修复 CMD 路径从 dist/main.js 改为 dist/src/main.js
- 添加构建输出验证步骤
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:16:20 -08:00
Developer
a503bda266
fix(leaderboard-service): 修复 DI 注入问题 - 使用 useExisting 替代 useClass
...
- ReferralServiceClient 和 IdentityServiceClient 使用 useExisting
- 避免在 DomainModule 中重新创建实例导致 HttpService 不可用
- 复用 InfrastructureModule 中已创建的实例
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:09:31 -08:00
Developer
7d87296d11
fix(leaderboard-service): 修复 Dockerfile 使用 Debian slim 解决 Prisma 兼容性问题
...
- Builder 阶段从 node:20-alpine 改为 node:20-slim
- 解决 Alpine Linux 上 @prisma/engines 下载失败问题 (ECONNRESET)
- 使用 COPY src ./src 替代 COPY . . 优化构建
- 添加构建输出验证步骤
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 07:03:08 -08:00
Developer
c3931255d3
fix(reward-service): 优化 Dockerfile 和添加 .dockerignore
...
问题:
1. Dockerfile 使用 COPY . . 会复制 node_modules 导致构建极慢
2. CMD 路径错误:dist/src/main.js 应该是 dist/main.js
修复:
- 添加 .dockerignore 排除 node_modules, dist 等
- 优化 Dockerfile 只复制必要文件 (COPY src ./src)
- 修正 CMD 路径为 dist/main.js
- 添加构建验证步骤 (test -f dist/main.js)
- 添加非 root 用户运行
- 添加健康检查
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:50:24 -08:00
Developer
fc26575693
fix(leaderboard-service): 删除 Dockerfile 中的 test stage
...
问题:Dockerfile 中的 test stage 放在最后,导致 docker build 默认使用
test stage 而不是 production stage。容器启动时运行 npm test 而不是
node dist/src/main.js。
修复:删除 test stage,只保留 builder 和 production stages。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:48:54 -08:00
Developer
b224e209a6
fix(mpc-service): 修复PostgreSQL兼容性问题
...
1. Dockerfile: 将DATABASE_URL协议从mysql改为postgresql
2. schema.prisma: 重命名索引以满足PostgreSQL全局唯一性要求
- idx_party_id -> idx_ps_party_id (party_shares)
- idx_session_id -> idx_ps_session_id (party_shares)
- idx_status -> idx_ps_status (party_shares)
- idx_session_id -> idx_ss_session_id (session_states)
- idx_party_id -> idx_ss_party_id (session_states)
- idx_status -> idx_ss_status (session_states)
已在WSL2中验证Docker构建成功。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 06:09:16 -08:00
Developer
a9594ef15e
fix(mpc-service): 修复数据库provider从mysql改为postgresql
...
mpc-service错误配置为mysql,与项目统一使用的postgresql不一致,
导致服务启动时Prisma验证DATABASE_URL失败。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 05:54:07 -08:00
Developer
1150d7e514
fix(wallet,referral): correct build output path to dist/main.js
...
These services build to dist/main.js (no src subdirectory).
Added build verification steps.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 05:38:36 -08:00
Developer
efd1156739
fix(mpc-service): correct build output path to dist/main.js
...
NestJS with tsconfig outDir: ./dist builds to dist/main.js, not dist/src/main.js.
Added build verification step to catch this earlier.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:41:29 -08:00
Developer
9b4a1d119c
fix(services): switch from Alpine to Debian slim for Prisma OpenSSL
...
Alpine 3.22 removed openssl1.1-compat package which Prisma needs.
Switched production stage from node:20-alpine to node:20-slim (Debian)
which has proper OpenSSL support.
Changes:
- Use node:20-slim for production stage (keep Alpine for build)
- Install openssl and wget via apt-get
- Update user creation from Alpine (addgroup/adduser) to Debian (groupadd/useradd)
Validated identity-service build and startup in WSL2:
- Build passes successfully
- NestJS starts and loads all routes
- Prisma client connects without OpenSSL errors
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:12:27 -08:00
Developer
c2b44eef29
fix(services): add OpenSSL 1.1 compatibility for Prisma in Alpine
...
Prisma engine requires libssl.so.1.1 which is not available in Alpine
Linux by default (Alpine uses OpenSSL 3.x). Added openssl1.1-compat
package to all service Dockerfiles.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 04:03:15 -08:00
Developer
7bb4259290
fix(services): correct NestJS build output path in all Dockerfiles
...
NestJS with sourceRoot: "src" outputs to dist/src/main.js not dist/main.js.
Fixed CMD paths in all service Dockerfiles:
- identity-service: dist/src/main.js (verified in WSL2)
- wallet-service: dist/src/main.js
- backup-service: dist/src/main.js
- planting-service: dist/src/main.js
- referral-service: dist/src/main.js
- reward-service: dist/src/main.js
- mpc-service: dist/src/main.js
- leaderboard-service: dist/src/main.js
- reporting-service: dist/src/main.js
- authorization-service: dist/src/main.js
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:56:02 -08:00
Developer
a23b786797
fix(identity-service): fix Dockerfile build and add .dockerignore
...
- Add .dockerignore to exclude unnecessary files from Docker context
- Explicitly copy tsconfig, nest-cli.json, and src directory
- Add build verification step (test -f dist/main.js)
- Change CMD from npm run to direct node command
- Add health check and non-root user for security
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:44:11 -08:00
Developer
0a0b7eb886
feat(services): add individual deploy scripts for each service
...
Add deploy.sh script to each service directory for independent
deployment and management:
- identity-service, wallet-service, backup-service
- planting-service, referral-service, reward-service
- mpc-service, leaderboard-service, reporting-service
- authorization-service
Each script supports:
- build / build-no-cache
- start / stop / restart
- logs / logs-tail
- status / health
- migrate / shell
Also updated main deploy.sh with build-no-cache command.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:36:50 -08:00
Developer
2a449aff3c
fix(identity-service): add DATABASE_URL for Prisma generate in Dockerfile
...
Fix build failure caused by missing DATABASE_URL environment variable
during prisma:generate step. Changed from npm run prisma:generate to
direct npx prisma generate with dummy DATABASE_URL.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 03:13:33 -08:00
Developer
77db1009dd
fix(services): add DATABASE_URL for Prisma generate in Dockerfiles
...
Add dummy DATABASE_URL environment variable prefix to all npx prisma
generate commands in Dockerfiles. Prisma requires DATABASE_URL at
build time to generate the client, but the actual value is only used
at runtime.
Services updated:
- authorization-service (postgresql)
- backup-service (postgresql)
- leaderboard-service (postgresql)
- mpc-service (mysql)
- planting-service (postgresql)
- referral-service (postgresql)
- reporting-service (postgresql)
- reward-service (postgresql)
- wallet-service (postgresql + npm install fix)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:54:31 -08:00
Developer
b39344a604
fix(wallet-service): use npm install instead of npm ci
...
wallet-service doesn't have package-lock.json, npm ci requires it.
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:28:24 -08:00
Developer
3dd561bd24
fix(services): comment out admin-service (not yet implemented)
...
- Comment out admin-service in docker-compose.yml
- Simplify admin-service Dockerfile to placeholder
- Fixes build error due to missing source files
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:19:54 -08:00
Developer
f99cac21cf
feat(services): add unified Docker deployment system
...
- Add docker-compose.yml for all 11 backend services
- Add deploy.sh automation script with install/build/up/down commands
- Add init-databases.sh for PostgreSQL multi-database initialization
- Add .env.example template with secure key placeholders
- Fix empty Dockerfiles for admin/referral/reporting/wallet services
Services included:
- identity-service (:3000)
- wallet-service (:3001)
- backup-service (:3002)
- planting-service (:3003)
- referral-service (:3004)
- reward-service (:3005)
- mpc-service (:3006)
- leaderboard-service (:3007)
- reporting-service (:3008)
- authorization-service (:3009)
- admin-service (:3010)
Infrastructure: PostgreSQL, Redis, Kafka/Zookeeper
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 02:12:49 -08:00
Developer
70e6391691
feat(mpc-system): 添加原生部署脚本,替代 Docker 部署
...
由于中国网络环境无法正常使用 Docker,添加原生部署方案:
新增文件:
- backend/mpc-system/scripts/deploy.sh - 一键部署脚本
脚本功能:
- install: 安装 Go 1.21、PostgreSQL、Redis、RabbitMQ
- build: 编译 Go 服务并配置基础设施
- start/stop/restart: 服务控制
- status: 查看服务状态
- logs: 查看服务日志
- uninstall: 卸载服务
更新文档:
- 更新 DEPLOYMENT_GUIDE.md 第 4 节为原生部署方式
- 添加 systemd 服务管理说明
- 添加 Nginx/iptables 端口映射配置
- 更新故障排查指南
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 23:24:16 -08:00
Developer
42735e41ef
docs: 更新 MPC-System 部署指南为 Docker Compose 一键部署
...
根据实际的 mpc-system/docker-compose.yml 更新部署文档:
- 更新系统要求 (Docker 24.0+, 4GB RAM)
- 添加服务架构说明 (account-service, session-coordinator 等)
- 提供一键部署步骤 (clone -> .env -> docker compose up)
- 添加 .env 配置模板
- 更新服务端口说明 (仅暴露 4000 端口)
- 更新 API 端点说明
- 添加运维命令参考
部署路径: /home/ceshi/rwadurian/backend/mpc-system
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 22:03:07 -08:00
Developer
01e192ea17
fix(nginx): 修复 CORS 配置,将 add_header 移出 if 块
...
nginx 不允许在 if 块中使用 add_header 指令,
将 CORS 配置提取到独立的 snippets/cors-params.conf 文件。
修改内容:
- 新增 cors-params.conf 配置文件
- 在每个 location 块中引入 cors-params.conf
- 从 server 块移除内联的 CORS 配置
- 更新目录结构说明和部署步骤
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:48:52 -08:00
Developer
6da6dba3f9
docs: 修复部署步骤顺序,SSL证书获取优先于站点配置
...
对于全新系统部署,必须先获取 Let's Encrypt 证书,
然后才能配置引用这些证书的 Nginx 站点配置。
修改内容:
- 将 SSL 证书获取移到步骤 3(配置站点之前)
- 提供 standalone 和 webroot 两种证书获取方式
- 添加清晰的步骤注释说明
- 移除不需要的 /etc/nginx/ssl 目录创建
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:21:25 -08:00
Developer
b94a9b3d25
docs: 更新文档索引,区分开发/生产环境部署指南
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 21:00:56 -08:00
Developer
c421a06f16
fix: 使用 Let's Encrypt 默认证书路径
...
- SSL 证书直接引用 /etc/letsencrypt/live/rwaapi.szaiai.com/
- 移除不必要的软链接创建步骤
- 添加 certbot 自动续期说明
- 更新 SSL 证书问题排查命令
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:59:59 -08:00
Developer
2ece6328ba
refactor: 重组 identity-service 文档目录结构
...
文档重组:
- 创建 docs/ 目录,移动所有 .md 文档
- 添加 docs/README.md 文档索引
Nginx 配置更新:
- 改用 sites-available/sites-enabled 标准结构
- 添加 snippets/ 目录存放可复用配置
- proxy-params.conf - 代理参数
- ssl-params.conf - SSL 安全参数
- 更新部署步骤,包含站点启用/禁用命令
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:58:40 -08:00
Developer
e082cda8b7
docs: 更新部署指南,MPC-System 部署在 Nginx 服务器 192.168.1.100
...
架构更新:
- Nginx + MPC-System 服务器 (192.168.1.100)
- Nginx 反向代理 (80/443)
- MPC-System Go 服务 (4000)
- 后端微服务服务器 (192.168.1.111)
- 所有 NestJS 微服务
- mpc-service 调用 192.168.1.100:4000
新增内容:
- MPC-System 部署指南 (systemd/Docker 两种方式)
- MPC-System API 端点说明
- 防火墙配置 (只允许后端服务器访问)
- MPC 相关故障排查
- 健康检查命令更新
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:47:34 -08:00
Developer
a9dc2b441e
docs: 更新部署指南,添加完整 Nginx 配置
...
更新内容:
- 明确后端服务部署在 192.168.1.111 服务器
- 添加完整的 Nginx 配置文件结构
- nginx.conf 主配置
- proxy_params.conf 代理参数
- rwaapi.conf API 网关配置
- 所有 upstream 指向 192.168.1.111 内网地址
- 添加 Docker Compose 完整配置 (10个微服务)
- 添加数据库初始化脚本
- 添加环境变量配置示例
- 添加部署步骤和验证命令
- 添加监控运维和常见问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:41:50 -08:00
Developer
2d50ad32a9
docs: 添加系统部署指南和更新 API 配置
...
添加 DEPLOYMENT_GUIDE.md:
- 完整的 Nginx 反向代理配置 (rwaapi.szaiai.com)
- Docker Compose 生产环境部署配置
- 后端服务端口规划和 API 路由映射
- 前端 API 调用对照表
- SSL/HTTPS 配置说明
- 部署步骤和常见问题
更新前端 API 配置:
- api_endpoints.dart: 更新 baseUrl 为 https://rwaapi.szaiai.com
- api_endpoints.dart: 添加 /api/v1 前缀到所有端点
- api_endpoints.dart: 添加 telemetry 遥测端点
- api_client.dart: 更新默认 baseUrl 为生产环境地址
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:39:11 -08:00
Developer
acb424a2da
chore(identity-service): 完善 Docker Compose 配置
...
- 移除过时的 version 属性
- 补充完整环境变量 (Redis, Kafka, MPC, Backup Service)
- 添加健康检查 (healthcheck) 配置
- 添加自动重启策略 (restart: unless-stopped)
- 修复 Kafka broker 内部地址 (kafka:29092)
- 配置 Zookeeper 健康检查和依赖条件
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 20:15:12 -08:00
Developer
1fe66f34fd
feat(reporting-service): Implement complete reporting service with DDD architecture
...
- Domain layer: ReportDefinition/ReportSnapshot aggregates, value objects (DateRange, ReportPeriod, etc.)
- Application layer: CQRS commands/queries, ReportingApplicationService
- Infrastructure layer: Prisma repositories, Redis cache, export services (Excel/CSV/PDF)
- API layer: REST controllers, DTOs with validation
- Testing: Unit tests, integration tests, E2E tests, Docker test environment
- Documentation: Architecture, API, Development, Testing, Deployment, Data Model docs
- Supports scheduled report generation, multi-format export, and data caching
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 08:12:57 -08:00
Developer
ea03df9059
feat(authorization-service): Implement complete authorization service with DDD architecture
...
## Features
- Province/City Company authorization (省代/市代授权)
- Community authorization (社区授权)
- Monthly assessment with ladder targets (月度阶梯考核)
- Team validation for referral chain conflicts (推荐链授权冲突检测)
- First place ranking rewards (区域第一名奖励)
## Architecture
- Domain Layer: Aggregates, Entities, Value Objects, Domain Events, Services
- Application Layer: Commands, Services, Schedulers
- Infrastructure Layer: Prisma ORM, Redis Cache, Kafka Events
- API Layer: Controllers, DTOs, Guards
## Testing
- Unit tests: 33 tests (aggregates, entities, value objects)
- Integration tests: 30 tests (domain services)
- E2E tests: 6 tests (API endpoints)
- Docker test environment with PostgreSQL, Redis, Kafka
## Documentation
- ARCHITECTURE.md: System design and DDD patterns
- API.md: REST API endpoints reference
- DEVELOPMENT.md: Development guide
- TESTING.md: Testing strategies and examples
- DEPLOYMENT.md: Docker/Kubernetes deployment
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 06:30:07 -08:00
Developer
9ab7ff3ef1
.
2025-12-01 03:54:55 -08:00
Developer
29cf03c1d2
feat(leaderboard-service): Implement complete leaderboard service with DDD architecture
...
## Features
- Daily/Weekly/Monthly leaderboard management
- Ranking score calculation (effectiveScore = totalTeamPlanting - maxDirectTeamPlanting)
- Virtual ranking system for display purposes
- Real-time ranking updates via scheduled tasks
- Redis caching for hot data
- Kafka messaging for event-driven updates
## Architecture
- Domain-Driven Design (DDD) with Hexagonal Architecture
- NestJS 10.x + TypeScript 5.x
- PostgreSQL 15 + Prisma ORM
- Redis (ioredis) for caching
- Kafka (kafkajs) for messaging
- JWT + Passport for authentication
- Swagger for API documentation
## Domain Layer
- Aggregates: LeaderboardRanking, LeaderboardConfig
- Entities: VirtualAccount
- Value Objects: LeaderboardType, LeaderboardPeriod, RankingScore, RankPosition, UserSnapshot
- Domain Events: LeaderboardRefreshedEvent, ConfigUpdatedEvent, RankingChangedEvent
- Domain Services: LeaderboardCalculationService, VirtualRankingGeneratorService, RankingMergerService
## Infrastructure Layer
- Prisma repositories implementation
- Redis cache service
- Kafka event publisher/consumer
- External service clients (ReferralService, IdentityService)
## Testing
- Unit tests: 72 tests passed (88% coverage on core domain)
- Integration tests: 7 tests passed
- E2E tests: 11 tests passed
- Docker containerized tests: 79 tests passed
## Documentation
- docs/ARCHITECTURE.md - Architecture design
- docs/API.md - API specification
- docs/DEVELOPMENT.md - Development guide
- docs/TESTING.md - Testing guide
- docs/DEPLOYMENT.md - Deployment guide
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 03:11:03 -08:00
Developer
cc33d01be3
.
2025-12-01 02:08:24 -08:00
Developer
9769012795
feat(reward-service): Implement complete reward service with DDD architecture
...
## Core Features
- 6 types of reward calculation (Share Right 500U, Province Team 20U,
Province Area 15U+1% hashpower, City Team 40U, City Area 35U+2% hashpower,
Community Right 80U)
- 24-hour countdown mechanism for pending rewards
- Reward settlement with multi-currency support (BNB/OG/USDT/DST)
- Automatic reward expiration with scheduled tasks
## Domain Layer
- RewardLedgerEntry aggregate root with state machine
(PENDING -> SETTLEABLE -> SETTLED, PENDING -> EXPIRED)
- RewardSummary aggregate for user reward overview
- Value objects: Money, Hashpower, RewardSource, RewardStatus, RightType
- Domain events: RewardCreated, RewardClaimed, RewardSettled, RewardExpired
- Domain services: RewardCalculationService, RewardExpirationService
## Application Layer
- RewardApplicationService for orchestrating business workflows
- RewardExpirationScheduler for automatic expiration processing
## Infrastructure Layer
- PostgreSQL persistence with Prisma ORM
- Redis caching integration
- Kafka event publishing/consuming
- External service clients (Referral, Authorization, Wallet)
## API Layer
- REST endpoints: /health, /rewards/summary, /rewards/details,
/rewards/pending, /rewards/settle
- JWT authentication with Passport.js
- Swagger/OpenAPI documentation
## Testing (77 tests, 100% pass rate)
- 43 unit tests for domain logic (Money, Hashpower, aggregates)
- 20 integration tests for application services
- 14 E2E tests for API endpoints
- Docker Compose test infrastructure (PostgreSQL, Redis, Kafka)
## Documentation
- docs/ARCHITECTURE.md - DDD architecture overview
- docs/API.md - REST API documentation
- docs/DEVELOPMENT.md - Developer guide
- docs/TESTING.md - Testing guide
- docs/DEPLOYMENT.md - Deployment guide
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 01:57:40 -08:00
Developer
85c820b5af
.
2025-12-01 00:32:30 -08:00
Developer
7ae98c7f5b
feat(referral-service): Implement complete referral service with DDD architecture
...
Implement the referral service microservice with comprehensive features:
## Domain Layer
- ReferralRelationship aggregate: manages user referral relationships
- TeamStatistics aggregate: tracks team statistics and leaderboard scores
- Value Objects: UserId, ReferralCode, ReferralChain, LeaderboardScore, ProvinceCityDistribution
- Domain Services: ReferralChainService, LeaderboardCalculationService
- Domain Events: ReferralRelationshipCreated, TeamStatisticsUpdated
## Application Layer
- ReferralService: create relationships, get user info, validate codes
- TeamStatisticsService: update statistics, get leaderboard, province/city distribution
- Commands: CreateReferralRelationship, UpdateTeamStatistics
- Queries: GetUserReferralInfo, GetDirectReferrals, GetLeaderboard, GetProvinceCityDistribution
- Event Handlers: UserRegisteredHandler, PlantingCreatedHandler
## Infrastructure Layer
- Prisma repositories with PostgreSQL
- Redis caching for leaderboard
- Kafka messaging for domain events
- JWT authentication guard
## API Layer
- REST endpoints for referral management
- Leaderboard endpoints with pagination
- Team statistics endpoints
- Health check endpoints
## Testing (127 unit + 35 integration + 16 E2E tests)
- Domain layer unit tests (100% coverage)
- Integration tests with mocks
- E2E tests with supertest
- Docker test environment with PostgreSQL, Redis, Redpanda
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 00:18:20 -08:00
Developer
b350d6b023
.
2025-11-30 19:04:47 -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
Developer
2d18155ac2
.
2025-11-30 17:35:08 -08:00
Developer
845d841bca
feat(wallet-service): Implement complete wallet service with DDD architecture
...
- Add domain layer with aggregates (WalletAccount, LedgerEntry, DepositOrder, SettlementOrder)
- Add value objects (Money, Balance, Hashpower, UserId, etc.)
- Add domain events for event-driven architecture
- Implement application layer with CQRS commands and queries
- Add infrastructure layer with Prisma repositories
- Implement REST API with NestJS controllers
- Add JWT authentication with guards and strategies
- Add comprehensive unit tests (69 tests) and E2E tests (23 tests)
- Add documentation: ARCHITECTURE.md, API.md, DEVELOPMENT.md, TESTING.md, DEPLOYMENT.md
- Add E2E testing guide for WSL2 environment
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 09:13:57 -08:00
Developer
a966d71fa0
.
2025-11-30 06:44:57 -08:00
Developer
adf52ae130
.
2025-11-29 22:25:57 -08:00
Developer
66199cc93e
feat(backup-service): Implement MPC backup share storage service
...
- Add DDD + Hexagonal architecture with NestJS 11.x
- Implement store/retrieve/revoke backup share endpoints
- Add AES-256-GCM double encryption for secure storage
- Add service-to-service JWT authentication
- Add rate limiting (3 retrieves per user per day)
- Add comprehensive audit logging
- Add test suite (37 unit + 21 mock E2E + 20 real DB E2E = 78 tests)
- Add documentation (architecture, API, development, testing, deployment)
- Add Docker and Kubernetes deployment configuration
- Add Prisma 7.x with @prisma/adapter-pg for PostgreSQL
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:12:41 -08:00
Developer
083db83c96
.
2025-11-29 19:22:42 -08:00
hailin
6fa4d7ac1d
feat: 添加MPC多方计算服务模块
...
新增 mpc-service 微服务,实现 MPC-TSS 门限签名功能:
架构设计:
- 采用六边形架构(Hexagonal Architecture)
- 实现 CQRS 命令查询职责分离模式
- 遵循 DDD 领域驱动设计原则
核心功能:
- Keygen: 分布式密钥生成协议参与
- Signing: 门限签名协议参与
- Share Rotation: 密钥份额轮换
- Share Management: 份额查询和管理
技术栈:
- NestJS + TypeScript
- Prisma ORM
- Redis (缓存和分布式锁)
- Kafka (事件发布)
- Jest (单元/集成/E2E测试)
测试覆盖:
- 单元测试: 81个
- 集成测试: 30个
- E2E测试: 15个
- 总计: 111个测试全部通过
文档:
- ARCHITECTURE.md: 架构设计文档
- API.md: REST API接口文档
- TESTING.md: 测试架构说明
- DEVELOPMENT.md: 开发指南
- DEPLOYMENT.md: 部署运维文档
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-27 17:31:43 -08:00
hailin
92a227b576
.
2025-11-24 12:00:38 +00:00
hailin
7367838324
.
2025-11-24 03:59:50 -08:00
hailin
9a00c611b7
.
2025-11-24 03:49:34 -08:00
hailin
ed5bafbfad
.
2025-11-24 03:46:12 -08:00
hailin
d09af9aa3e
.
2025-11-24 03:43:25 -08:00
hailin
cf706d95a8
.
2025-11-24 11:40:27 +00:00
hailin
c08a692c97
.
2025-11-24 03:38:54 -08:00
hailin
0340d068e7
.
2025-11-24 03:35:26 -08:00
hailin
9e854c3888
.
2025-11-24 11:30:43 +00:00
hailin
ff65cdf3c1
.
2025-11-24 03:26:09 -08:00
hailin
4cdd0b07b9
.
2025-11-24 03:21:24 -08:00
hailin
fbcef7aba2
.
2025-11-24 03:14:38 -08:00
hailin
ff2bbbc977
.
2025-11-24 03:11:05 -08:00
hailin
0e9dc61961
.
2025-11-24 03:03:41 -08:00
hailin
169ca891e6
.
2025-11-24 02:58:50 -08:00
hailin
0b1defb78b
.
2025-11-24 02:54:27 -08:00
hailin
3aaac6af6f
.
2025-11-24 02:50:45 -08:00
hailin
c6c2545095
.
2025-11-24 02:38:15 -08:00
hailin
77725bd769
.
2025-11-24 02:33:14 -08:00
hailin
015f314907
.
2025-11-24 02:31:30 -08:00
hailin
8e3aa0e794
.
2025-11-24 02:29:44 -08:00
hailin
f9a0f95cab
.
2025-11-24 02:19:40 -08:00
hailin
4fbca69942
.
2025-11-24 02:12:13 -08:00
hailin
d8f23a8913
.
2025-11-24 02:08:47 -08:00
hailin
abc87306d2
.
2025-11-24 01:59:58 -08:00
hailin
dce2ea5963
.
2025-11-24 01:48:17 -08:00
hailin
8f639273b1
.
2025-11-24 01:41:54 -08:00
hailin
19b6415c95
.
2025-11-24 17:06:30 +08:00
hailin
ef1ef8ba25
.
2025-11-24 08:27:36 +00:00
hailin
1469b45723
.
2025-11-24 07:49:40 +00:00
hailin
4b03c422ea
.
2025-11-24 07:47:29 +00:00
hailin
e2055483db
.
2025-11-24 07:25:33 +00:00
hailin
44d2e2ad80
.
2025-11-24 06:58:46 +00:00
hailin
c29c185a03
identity_service_context first commit
2025-11-24 06:09:06 +00:00
hailin
b9a3fb9a83
first commit
2025-11-23 21:21:44 -08:00