hailin
28ad8c2e2f
feat(2.0-services): 为auth/mining/trading服务添加Outbox事件发布机制
...
- auth-service:
- 添加Kafka生产者模块和服务
- 添加Redis服务用于分布式锁
- 添加OutboxScheduler定时发布Outbox事件到Kafka
- 更新InfrastructureModule为全局模块
- mining-service:
- 添加Kafka生产者服务
- 添加OutboxRepository用于管理Outbox事件
- 添加OutboxScheduler定时发布事件
- trading-service:
- 添加Kafka生产者服务
- 添加OutboxRepository用于管理Outbox事件
- 添加OutboxScheduler定时发布事件
所有服务的Outbox调度器:
- 每30秒发布待处理的事件到Kafka
- 每天凌晨3点清理7天前已处理的事件
- 使用Redis分布式锁确保多实例部署时只有一个实例处理
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:54:37 -08:00
hailin
15a5fb6c14
feat(mining-admin-service): 添加CDC同步和完整用户管理API
...
## Prisma Schema 更新
- 添加 CDC 同步表:SyncedUser, SyncedContributionAccount, SyncedMiningAccount, SyncedTradingAccount
- 添加系统数据同步表:SyncedMiningConfig, SyncedDailyMiningStat, SyncedDayKLine, SyncedCirculationPool
- 添加 CDC 进度跟踪:CdcSyncProgress, ProcessedEvent
## CDC 消费者模块
- CdcConsumerService: Kafka 消费者,支持 Debezium CDC 和服务间事件
- CdcSyncService: 同步处理器,从 auth/contribution/mining/trading 服务同步数据
## 新增 API 端点
### 用户管理 (/api/v1/users)
- GET /users - 用户列表(分页、搜索、过滤)
- GET /users/:accountSequence - 用户详情
- GET /users/:accountSequence/contributions - 算力记录
- GET /users/:accountSequence/mining-records - 挖矿记录
- GET /users/:accountSequence/orders - 交易订单
### 系统账户 (/api/v1/system-accounts)
- GET /system-accounts - 系统账户列表
- GET /system-accounts/summary - 系统账户汇总
### 仪表盘增强 (/api/v1/dashboard)
- GET /dashboard - 统计数据(新增用户/算力/挖矿/交易统计)
- GET /dashboard/realtime - 实时数据
- GET /dashboard/stats - 统计数据(别名)
## Docker Compose 更新
- 添加 Kafka 依赖和 CDC topic 配置
- 添加与 auth-service 的依赖关系
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:36:21 -08:00
hailin
2a09fca728
chore(mining-admin-web): 添加.gitignore文件
...
忽略以下自动生成的文件:
- node_modules/
- .next/
- next-env.d.ts
- *.tsbuildinfo
- .env*.local
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:18:35 -08:00
hailin
b0434184ae
feat(mining-admin-web): 添加Nginx配置和Let's Encrypt自动证书
...
- madmin.szaiai.com.conf: Nginx反向代理配置(端口3100)
- install.sh: 一键安装脚本,自动申请Let's Encrypt证书
- 支持HTTP自动重定向到HTTPS
- 配置证书自动续期
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:15:50 -08:00
hailin
3f79361fde
feat(mining-admin-web): 添加独立部署脚本和docker-compose配置
...
- deploy.sh: 一键部署脚本(build/start/stop/restart/logs/clean)
- docker-compose.yml: 独立容器化配置,使用rwa-network网络
- 与admin-web的部署方式保持一致
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:06:20 -08:00
hailin
6ffde0f4c6
refactor(docker): 2.0系统共享1.0基础设施并保持完全隔离
...
- 网络: 使用共享的 rwa-network (external)
- 数据库: 连接 postgres:5432,使用独立数据库名
- Redis: 连接 redis:6379,使用 DB 10-14 分区隔离
- Kafka: 连接 kafka:29092,仅消费 CDC 事件(单向同步)
- 服务依赖: 添加 postgres/redis/kafka 健康检查依赖
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 20:01:15 -08:00
hailin
821c70bf38
feat(docker): 添加 2.0 系统 Docker 部署支持
...
为所有 2.0 服务添加 Dockerfile 和 docker-compose 配置:
后端服务:
- contribution-service (3020) - 算力服务
- mining-service (3021) - 挖矿服务
- trading-service (3022) - 交易服务
- mining-admin-service (3023) - 管理后台 API
- auth-service (3024) - 用户认证服务
前端服务:
- mining-admin-web (3100) - 管理后台前端
Docker 配置:
- docker-compose.2.0.yml: 独立的 2.0 系统编排文件
- 多阶段构建优化镜像大小
- 健康检查确保服务可用性
- 服务依赖顺序正确
部署脚本更新:
- deploy-mining.sh 使用 docker-compose.2.0.yml
- 添加 mining-admin-web 服务别名 (web, admin-web)
- 更新服务端口配置
使用方式:
cd backend/services
docker-compose -f docker-compose.2.0.yml up -d
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 19:31:02 -08:00
hailin
f7278b6196
feat(auth-service): 添加用户认证服务2.0
...
实现完整的用户认证服务,支持1.0用户迁移和2.0新用户注册:
功能特性:
- 用户注册(生成V2格式accountSequence: 15位)
- 密码登录(支持V1迁移用户和V2用户)
- V1用户首次登录自动迁移到2.0系统
- 短信验证码发送/验证(注册/登录/重置密码/更换手机号)
- 密码管理(重置密码、修改密码)
- KYC实名认证(提交/审核资料)
- JWT认证(Access Token + Refresh Token)
技术架构:
- DDD六边形架构(Domain/Application/Infrastructure/API)
- Prisma ORM + PostgreSQL
- CDC消费者同步1.0用户数据
- Outbox模式发布领域事件
- NestJS ThrottlerModule限流
数据模型:
- User: 2.0用户表(含KYC字段)
- SyncedLegacyUser: CDC同步的1.0用户(只读)
- RefreshToken: 刷新令牌
- SmsVerification: 短信验证码
- DailySequenceCounter: 每日序号计数器
- OutboxEvent: 发件箱事件
AccountSequence格式:
- V1: D + YYMMDD + 5位序号 = 12字符
- V2: D + YYMMDD + 8位序号 = 15字符
服务端口:3024
数据库:rwa_auth
同时更新deploy-mining.sh添加auth-service支持。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:50:59 -08:00
hailin
c8c2e63da6
feat(mining): 增强部署脚本支持单服务操作
...
## 新增功能
### 单服务操作
- `up [service]` - 启动全部或指定服务
- `down [service]` - 停止全部或指定服务
- `restart [service]` - 重启全部或指定服务
- `build [service] [--no-cache]` - 构建全部或指定服务
- `rebuild [service]` - 等同于 build --no-cache
### 服务别名
- `contrib`, `contribution` -> contribution-service
- `mining` -> mining-service
- `trading` -> trading-service
- `admin` -> mining-admin-service
### 单服务数据库操作
- `db-create [service]` - 创建全部或指定服务的数据库
- `db-migrate [service]` - 运行全部或指定服务的迁移
- `db-reset [service]` - 重置全部或指定服务的数据库
### 构建功能增强
- `--no-cache` 选项清除 dist/ 和 node_modules/.cache
- 自动运行 npm install
- 自动生成 Prisma client
- 编译 TypeScript
### 状态显示增强
- 显示服务 PID
- 通过端口检测运行状态
- 健康检查端点验证
## 使用示例
```bash
./deploy-mining.sh up mining # 仅启动 mining-service
./deploy-mining.sh restart contrib # 重启 contribution-service
./deploy-mining.sh build trading --no-cache # 清除缓存重新构建
./deploy-mining.sh logs admin 200 # 查看最后200行日志
./deploy-mining.sh db-reset mining # 仅重置 mining-service 数据库
```
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:12:38 -08:00
hailin
7c3bf4f068
feat(mining): 添加 2.0 挖矿系统独立部署管理脚本
...
添加 deploy-mining.sh 脚本用于管理 2.0 挖矿生态系统,
该系统与 1.0 完全隔离,可随时重置而不影响 1.0。
## 功能
### 服务管理
- up/down/restart - 启动/停止/重启 2.0 服务
- status - 查看服务状态
- logs [service] - 查看日志
- build - 构建服务
### 数据库管理
- db-create - 创建 2.0 数据库
- db-migrate - 运行 Prisma 迁移
- db-reset - 删除并重建数据库(危险操作)
- db-status - 查看数据库状态
### CDC 同步管理
- sync-reset - 重置 CDC 消费者偏移量到开始位置
- sync-status - 查看 CDC 消费者组状态
### 完整重置
- full-reset - 完整系统重置
1. 停止所有 2.0 服务
2. 删除所有 2.0 数据库
3. 重建数据库
4. 运行迁移
5. 重置 CDC 偏移量
6. 重启服务(从 1.0 重新同步)
### 健康监控
- health - 检查所有组件健康状态
- stats - 显示系统统计信息
## 2.0 服务
- contribution-service (3020)
- mining-service (3021)
- trading-service (3022)
- mining-admin-service (3023)
## 2.0 数据库
- rwa_contribution
- rwa_mining
- rwa_trading
- rwa_mining_admin
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:08:16 -08:00
hailin
a17f408653
feat(mining-ecosystem): 添加挖矿生态系统完整微服务与前端
...
## 概述
为榴莲生态2.0添加完整的挖矿系统,包含3个后端微服务、1个管理后台和1个用户端App。
---
## 后端微服务
### 1. mining-service (挖矿服务) - Port 3021
**核心功能:**
- 积分股每日分配(基于算力快照)
- 每分钟定时销毁(进入黑洞)
- 价格计算:价格 = 积分股池 ÷ (100.02亿 - 黑洞 - 流通池)
- 全局状态管理(黑洞量、流通池、价格)
**关键文件:**
- src/application/services/mining-distribution.service.ts - 挖矿分配核心逻辑
- src/application/schedulers/mining.scheduler.ts - 定时任务调度
- src/domain/services/mining-calculator.service.ts - 分配计算
- src/infrastructure/persistence/repositories/black-hole.repository.ts - 黑洞管理
### 2. trading-service (交易服务) - Port 3022
**核心功能:**
- 积分股买卖撮合
- K线数据生成
- 手续费处理(10%买入/卖出)
- 流通池管理
- 卖出倍数计算:倍数 = (100亿 - 销毁量) ÷ (200万 - 流通池量)
**关键文件:**
- src/domain/services/matching-engine.service.ts - 撮合引擎
- src/application/services/order.service.ts - 订单处理
- src/application/services/transfer.service.ts - 划转服务
- src/domain/aggregates/order.aggregate.ts - 订单聚合根
### 3. mining-admin-service (挖矿管理服务) - Port 3023
**核心功能:**
- 系统配置管理(分配参数、手续费率等)
- 老用户数据初始化
- 系统监控仪表盘
- 审计日志
**关键文件:**
- src/application/services/config.service.ts - 配置管理
- src/application/services/initialization.service.ts - 数据初始化
- src/application/services/dashboard.service.ts - 仪表盘数据
---
## 前端应用
### 1. mining-admin-web (管理后台) - Next.js 14
**技术栈:**
- Next.js 14 + React 18
- TailwindCSS + Radix UI
- React Query + Zustand
- ECharts 图表
**功能模块:**
- 登录认证
- 仪表盘(实时数据、价格走势)
- 用户查询(算力详情、挖矿记录、交易订单)
- 系统配置管理
- 数据初始化任务
- 审计日志查看
### 2. mining-app (用户端App) - Flutter 3.x
**技术栈:**
- Flutter 3.x + Dart
- Riverpod 状态管理
- GoRouter 路由
- Clean Architecture (3层)
**功能模块:**
- 首页资产总览
- 实时收益显示(每秒更新)
- 贡献值展示(个人/团队)
- 积分股买卖交易
- K线图与价格显示
- 个人中心
---
## 架构文档
- docs/mining-ecosystem-architecture.md - 系统架构总览
- 服务职责与端口分配
- 数据流向图
- Kafka Topics 定义
- 跨服务关联(account_sequence)
- 配置参数说明
- 开发顺序建议
---
## .gitignore 更新
- 添加 Flutter/Dart 构建文件忽略
- 添加 iOS/Android 构建产物忽略
- 添加 Next.js 构建目录忽略
- 添加 TypeScript 缓存文件忽略
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:45:46 -08:00
hailin
eaead7d4f3
feat(contribution-service): 添加算力管理微服务
...
## 概述
为榴莲生态2.0添加 contribution-service 微服务,负责算力计算、分配和快照管理。
## 架构设计
- 采用 DDD + Hexagonal Architecture (六边形架构)
- 使用 NestJS 框架 + Prisma ORM
- 通过 Kafka CDC (Debezium) 从 user-service 同步数据
- 使用 accountSequence (而非 userId) 进行跨服务关联
## 核心功能模块
### 1. Domain Layer (领域层)
- ContributionAccountAggregate: 算力账户聚合根
- ContributionRecordAggregate: 算力记录聚合根
- ContributionAmount: 算力金额值对象 (基于 Decimal.js)
- DistributionRate: 分配比例值对象
- ContributionSourceType: 算力来源类型枚举 (PERSONAL/TEAM_LEVEL/TEAM_BONUS)
### 2. Application Layer (应用层)
- ContributionCalculationService: 算力计算核心服务
- 个人算力: 认种金额 × 10
- 团队等级奖励: 基于直推有效认种人数
- 团队极差奖励: 多级分销算法
- SnapshotService: 每日算力快照服务
- CDC Event Handlers: 处理用户、认种、引荐关系同步事件
### 3. Infrastructure Layer (基础设施层)
- Prisma Repositories:
- ContributionAccountRepository
- ContributionRecordRepository
- SyncedDataRepository (同步数据)
- OutboxRepository (发件箱模式)
- SystemAccountRepository
- UnallocatedContributionRepository
- Kafka CDC Consumer: 消费 Debezium CDC 事件
- Redis: 缓存支持
- UnitOfWork: 事务管理
### 4. API Layer (接口层)
- ContributionController: 算力查询接口
- SnapshotController: 快照管理接口
- HealthController: 健康检查
## 数据模型 (Prisma Schema)
- ContributionAccount: 算力账户
- ContributionRecord: 算力记录 (支持过期)
- DailyContributionSnapshot: 每日快照
- SyncedUser/SyncedAdoption/SyncedReferral: CDC 同步数据
- OutboxEvent: 发件箱事件
- SystemContributionAccount: 系统账户
- UnallocatedContribution: 未分配算力
## TypeScript 类型修复
- 修复所有 Repository 接口与实现的类型不匹配
- 修复 ContributionAmount.multiply() 返回值类型
- 修复 isZero getter vs method 问题
- 修复 bigint vs string 类型转换
- 统一使用 items/total 返回格式
- 修复 Prisma schema 字段名映射 (unallocType, contributionBalance 等)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:39:25 -08:00
hailin
d9f9ae5122
chore(mobile-app): 更新开屏静态图片
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 10:42:53 -08:00
hailin
dd1531fbb8
fix(mobile-app): 移除pubspec.yaml中已删除的splash_frames目录
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 10:36:01 -08:00
hailin
57239e81dd
chore(mobile-app): 优化开屏资源和UI文案
...
- 删除36张帧动画图片减小包体积
- 静态开屏图片从3张改为2张
- 将"权益激活"改为"权益已激活"
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 10:29:37 -08:00
hailin
bc73b078bd
fix(wallet-service): 将最小划转金额从100改为5
...
与前端配置保持一致
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:51:06 -08:00
hailin
dab4b0674d
fix(mobile-app): 修复引荐列表展开无法显示更多数据的问题
...
- 使用实际总数作为limit参数请求API
- 添加调试日志便于排查
- 优化:已加载全部数据时直接展开不重复请求
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 09:13:07 -08:00
hailin
8eb5b410cc
feat(mobile-app): 引荐列表支持展开/收拢功能
...
- 初始只显示前10条引荐记录
- 超过10人时显示"..."按钮可点击展开全部
- 展开后显示"收起"按钮可点击收拢
- 加载更多时显示loading指示器
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:59:03 -08:00
hailin
4ee355a7cd
fix(mobile-app): 开屏图片改为保持原比例不拉伸
...
使用 BoxFit.contain 替代 BoxFit.cover,
图片保持原比例显示,不足部分用黑边填充。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:51:26 -08:00
hailin
96695575d5
feat(mobile-app): 启用兑换页面的划转功能
...
移除划转按钮的临时禁用标志,恢复正常功能。
用户点击划转按钮后将跳转到划转页面。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:48:45 -08:00
hailin
414fe95d04
feat(mobile-app): 开屏页改为随机静态图片模式
...
- 禁用帧动画,改为显示随机静态图片(3张中随机选1张)
- 显示3秒后自动跳转,保留跳过按钮
- 帧动画代码保留备用,可通过 _useStaticImage 开关切换
- 新增 splash_static 目录存放静态图片
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:19:25 -08:00
hailin
fabfbb73fe
fix(mobile-app): 修复开机动画卡住问题
...
问题原因:
1. TelemetryConfig.syncFromRemote() URL拼接错误,导致请求无效路径
2. 遥测配置同步使用await阻塞,即使失败也要等待超时
修复内容:
1. 修正URL拼接:apiBaseUrl已包含/api/v1,不再重复添加
2. 将超时时间从10秒缩短为5秒
3. 将遥测配置同步改为非阻塞,不再await等待
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 08:08:21 -08:00
hailin
ca1bc74b2a
feat(admin-web): 用户钱包分类账明细添加备注列
...
在用户管理页面的钱包分类账明细表格中添加"备注"列,
用于显示转账对象信息,如"转账至 D25XXXXXX"或"来自 D25XXXXXX 的转账"。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 07:20:21 -08:00
hailin
7a4a207bed
feat(mobile-app): 增强合同PDF下载可靠性和用户体验
...
- PDF下载增加10次自动重试机制,使用指数退避策略
- 超时时间延长至300秒,适应大文件和慢网络
- 新增下载进度显示(百分比圆环)
- 失败后显示重试按钮,区分任务加载错误和PDF下载错误
- ApiClient.get方法新增cancelToken和onReceiveProgress参数支持
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 07:12:21 -08:00
hailin
f7b2267583
feat(mobile-app): 临时禁用划转功能
...
划转功能暂时维护中,点击按钮会显示提示信息。
恢复时将 isTransferDisabled 改为 false 即可。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 02:56:26 -08:00
hailin
990f218051
fix(mobile-app): 修复认种订单解析和状态检查问题
...
1. 修复 getMyOrders 解析:兼容后端直接返回数组格式
2. 添加 MINING_ENABLED 订单状态枚举和解析
3. 在 ADOPTION_WIZARD 完成检查中包含 miningEnabled 状态
问题原因:
- 后端返回订单列表格式是直接数组 [...],前端期望的是 {items: [...]}
- 后端返回的 MINING_ENABLED 状态未在前端枚举中定义
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 02:49:31 -08:00
hailin
96a84cc281
fix(mobile-app): 修复认种向导完成后无法返回待办页面的问题
...
问题:认种向导完成后使用 context.go() 跳转到合同签署页面,
替换了整个导航栈,导致合同签署完成后无法返回待办页面继续处理其他待办。
修复:改用 context.push() 跳转到合同签署页面,保留导航栈,
合同签署完成后可以正确返回待办页面。
同时添加了详细的调试日志,便于排查问题。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 02:43:23 -08:00
hailin
1a617e02f8
fix(mobile-app): 将授权申请页面的'伞下'改为'下'
2026-01-09 02:23:20 -08:00
hailin
d79fd9273b
fix(admin-service): 修复uploads目录权限问题
2026-01-09 02:14:37 -08:00
hailin
d1a52e74a0
fix(mobile-app): 修复认种向导待办操作无法正确标记完成的问题
...
问题:用户完成认种并签署合同后,ADOPTION_WIZARD待办操作没有被标记为完成,
导致用户被卡在待办操作页面无法进入App。
原因:原来的检查逻辑只检查是否有"待签合同",当用户已签署合同后,
pendingTasks为空,返回false,导致待办操作无法完成。
修复方案:
- 改为检查用户是否有已支付的认种订单(PAID/FUND_ALLOCATED状态)
- 通过比较订单创建时间和待办操作创建时间来判断
- 订单在待办操作之后创建 → 已完成
- 订单在待办操作之前但相差不超过24小时 → 也认为已完成(兼容延迟)
- 保留待签合同的备用检查逻辑
影响范围:仅影响ADOPTION_WIZARD待办操作的完成检测
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 02:03:22 -08:00
hailin
00264a721e
fix(admin-web): 优化授权页面错误提示,显示后端真实错误信息
...
问题:创建授权失败时只显示"Request failed with status code 400"
用户无法了解失败的真实原因(如用户未种树、授权冲突等)
修复:
- handleCreate和handleRevoke的catch块优先从err.response.data.message提取后端错误
- 后端已有完善的错误提示如"用户尚未认种任何树,无法授权"
- 前端现在能正确显示这些提示帮助管理员了解真实情况
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 21:38:00 -08:00
hailin
4d944b06e5
fix(admin-service): 添加uploads目录的volume持久化配置
...
问题:admin-service重新部署后,上传的APK文件会丢失
原因:主docker-compose.yml中admin-service未配置volume挂载,
导致容器重建时/app/uploads目录数据丢失
修复:
- 添加admin_uploads_data volume挂载到/app/uploads
- 添加UPLOAD_DIR环境变量
- 在volumes部分声明admin_uploads_data
影响范围:仅影响admin-service的文件存储持久化
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 21:00:31 -08:00
hailin
45736c4daf
fix(admin-service): 修复用户数据CDC同步使用userId导致的数据不一致问题
...
问题原因:
- 旧的Kafka事件消费者和CDC消费者同时运行
- 旧消费者写入的数据userId可能为0
- CDC消费者使用userId作为upsert条件,导致唯一键冲突失败
- 用户的nickname和kycStatus等信息没有正确同步
修复方案:
- upsert方法改用accountSequence作为唯一键
- CDC消费者的handleUpdate使用accountSequence检查和更新
- 更新时同时修复可能错误的userId
- 新增existsByAccountSequence和updateKycStatusByAccountSequence方法
影响范围:
- admin-web用户管理页面现在能正确显示用户昵称和KYC状态
- 新用户注册后数据能正确同步
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 20:35:30 -08:00
hailin
51114f265d
fix(planting-service): 修复合同PDF签署日期显示为UTC时间的问题
...
合同生成时使用 new Date().toISOString().split('T')[0] 获取日期,
该方法返回UTC时间,导致北京时间凌晨签署的合同显示为前一天日期。
修复方案:新增 getBeijingDateString() 函数,将UTC时间转换为北京时间(UTC+8)
影响范围:仅影响PDF合同上显示的签署日期,不影响数据库时间戳或业务逻辑
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 11:42:16 -08:00
hailin
641612a5d0
fix(wallet-service): 修复提现订单查询使用 userId 的问题
...
将提现订单查询从 userId 改为使用 accountSequence:
- getWithdrawals: 使用 findByAccountSequence 替代 findByUserId
- getFiatWithdrawals: 使用 findByAccountSequence 替代 findByUserId
- 新增 withdrawal-order.repository 的 findByAccountSequence 方法
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 11:24:31 -08:00
hailin
217be89c43
fix(wallet-service): 修复流水查询使用 userId 导致记录丢失的问题
...
将所有流水查询从 userId 改为使用 accountSequence:
- getMyLedger: 使用 findByAccountSequence 替代 findByUserId
- getLedgerStatistics: 查询改为按 accountSequence
- getLedgerTrend: 查询改为按 accountSequence
- findByAccountSequence: 添加 HIDDEN_ENTRY_TYPES 过滤
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 11:16:04 -08:00
hailin
53df97839d
fix(reporting-service): 修复 roleType 可能为 undefined 的类型错误
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 10:21:36 -08:00
hailin
ee6a092a1a
fix(authorization-service): 修复授权查询使用错误字段导致省市互斥验证失效
...
问题:数据库 user_id 列存储的是 accountSequence,但查询时使用 userId.value,
导致查询不到已有授权记录,省市互斥验证被绕过。
修复方法:所有基于 UserId 的查询改为使用 accountSequence 字段:
- findByUserIdAndRoleType
- findByUserIdRoleTypeAndRegion
- findByUserId
- findPendingByUserId
- findAllByUserIdIncludeDeleted
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 10:15:40 -08:00
hailin
347e5ce3de
fix(reporting-service): 修复授权事件区域名称显示 undefined
...
不同授权事件使用不同的字段名:
- province 事件:provinceCode/provinceName
- city 事件:cityCode/cityName
- community 事件:communityName
- 通用:regionCode/regionName
现在正确处理所有变体,避免显示 "undefined undefined 完成授权"
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:51:11 -08:00
hailin
1676e82cc6
fix(admin-service): 认种汇总和分类账只显示已支付订单
...
过滤掉 CREATED、PROVINCE_CITY_CONFIRMED、CANCELLED 状态的订单,
只统计已支付及之后的订单(PAID, FUND_ALLOCATED, POOL_SCHEDULED, POOL_INJECTED, MINING_ENABLED)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:37:28 -08:00
hailin
2553d05902
chore(api-gateway): 提升速率限制100倍
...
- minute: 100 → 10000
- hour: 5000 → 500000
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:19:50 -08:00
hailin
b5105d6bd1
fix(snapshot): 修改 Services PostgreSQL 用户名为 rwa_user
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 09:05:22 -08:00
hailin
bc38ec6ec0
feat(wallet-service): 三层保护机制确保内部转账接收方钱包存在
...
新增三层保护机制:
1. 用户注册时:监听 identity.UserAccountCreated 事件自动创建钱包
2. 发起转账时:检测内部转账后调用 ensureWalletExists() 预创建钱包
3. 链上确认时:原有 upsert 逻辑兜底(保持不变)
新增文件:
- identity-event-consumer.service.ts: 消费 identity 用户注册事件
- user-account-created.handler.ts: 处理用户注册事件创建钱包
新增 API:
- POST /wallets/ensure-wallet: 确保单个钱包存在
- POST /wallets/ensure-wallets: 批量确保钱包存在
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 07:33:47 -08:00
hailin
68841abbf4
fix(reporting-service): 修复错误的 Kafka topic 订阅
...
- 充值事件:blockchain.deposit.credited → wallet.acks (过滤 wallet.deposit.credited)
- 权益事件:authorization.benefit.applied → 整合到 authorization-events (过滤 benefit.activated)
原来订阅的 topic 不存在,导致事件无法消费。现已修复为正确的 topic。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 06:01:08 -08:00
hailin
38fff077dd
feat(reporting-service): 新增多种活动事件类型
...
扩展仪表板"最近活动"功能,新增以下活动类型:
活动类型新增:
- kyc_submitted: KYC认证提交
- kyc_approved: KYC认证通过
- kyc_rejected: KYC认证拒绝
- contract_signed: 合同签署
- deposit: 充值到账
- withdrawal: 提现成功
- benefit_applied: 权益申请
监听的 Kafka Topics:
- identity.KYCSubmitted
- identity.KYCApproved
- identity.KYCRejected
- contract.signed
- blockchain.deposit.credited
- wallet.withdrawals (仅处理 completed 事件)
- authorization.benefit.applied
所有新增事件处理器均使用幂等创建,防止重复记录。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:51:26 -08:00
hailin
65bd6a857f
fix(reporting-service): 添加活动记录幂等性处理
...
问题:Kafka 消息重试或重复消费时,同一事件会被记录多次活动,
导致"最近活动"显示重复条目,统计数据也会被重复累加。
修复:
1. 仓储层新增 exists() 和 createIfNotExists() 方法
2. 所有事件消费者改用幂等创建,仅首次创建时累加统计
3. 添加数据库唯一约束 uk_sa_entity_activity 作为最后防线
4. 迁移脚本会自动清理历史重复数据
影响的事件:
- identity.UserAccountCreated
- identity.UserAccountAutoCreated
- authorization-events
- planting.order.paid
- reporting.report.generated
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:46:43 -08:00
hailin
c65d02ebea
fix(admin-web): 仅在没有上级时显示总部节点
...
- 有上级时显示祖先节点列表
- 没有上级时才显示"总部"节点
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:31:07 -08:00
hailin
a86116fef4
fix(admin-service): 修复祖先节点数据获取依赖 user_query_view 的问题
...
问题:当祖先用户存在于 referral_query_view 但不存在于
user_query_view 时(CDC 同步延迟),祖先节点的
accountSequence 和统计数据无法正确获取。
修复:
- 改用 referralAccountSequences(从 referrals 获取)
替代 userAccountSequences(从 users 获取)
- 确保即使用户基本信息未同步,仍能获取正确的认种统计
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:30:00 -08:00
hailin
ca337bcdb7
fix(admin-service): 优先从 referralQueryView 获取祖先 accountSequence
...
修复祖先节点可能缺少 accountSequence 的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:23:46 -08:00
hailin
9050a4adca
fix(admin-web): 引荐关系树总部节点始终显示在顶端
...
- 总部节点始终显示在引荐人链最顶端
- 总部节点不可点击(cursor: default)
- 连接符方向改为向下(↓)表示引荐关系
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 05:19:01 -08:00