hailin
92772f071a
feat(ui): 优化待领取明细显示和移除认种数量限制
...
- 移除单次认种100棵的数量限制 (planting-service)
- 龙虎榜省市信息分两行显示
- 待领取明细改为堆叠卡片样式,节省屏幕空间
- 支持上下滑动选择卡片
- 滑动时有震动反馈
- 选中卡片展开显示完整信息
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 22:46:48 -08:00
hailin
2399cc29d6
fix(authorization): 修正省区域角色唯一性检查逻辑
...
将省区域角色从"全系统唯一"改为"按省份唯一":
- 修改 grantProvinceCompany 使用 findProvinceCompanyByRegion 检查
- 删除废弃的 findAnyProvinceCompany 方法
- 现在不同省份可以分别授权给不同账户
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 17:20:36 -08:00
hailin
2730bcb354
feat(identity): 完善账户安全和恢复功能
...
1. 账户冻结/解冻功能:
- POST /user/freeze: 用户主动冻结账户
- POST /user/unfreeze: 验证身份后解冻账户(支持助记词或手机号验证)
- 添加 AccountUnfrozenEvent 审计事件
2. 密钥轮换功能:
- POST /user/key-rotation/request: 验证助记词后请求 MPC 密钥轮换
- 添加 KeyRotationRequestedEvent 事件触发后台轮换
3. 恢复码备份功能:
- POST /user/backup-codes/generate: 生成8个一次性恢复码
- POST /user/recover-by-backup-code: 使用恢复码恢复账户
- 恢复码存储在 Redis,有效期1年
- 每个恢复码只能使用一次
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 17:06:28 -08:00
hailin
f2a6c09d86
feat(identity/blockchain): 增强助记词安全性和审计日志
...
1. blockchain-service 助记词验证增强:
- 验证前先检查是否存在已挂失(REVOKED)的助记词记录
- 如果检测到挂失记录,立即拒绝恢复请求
2. identity-service 审计日志事件:
- 新增 AccountRecoveredEvent: 账户恢复成功事件
- 新增 AccountRecoveryFailedEvent: 账户恢复失败事件
- 新增 MnemonicRevokedEvent: 助记词挂失事件
3. 恢复操作审计:
- recoverByMnemonic: 记录所有失败原因和成功事件
- recoverByPhone: 记录所有失败原因和成功事件
- revokeMnemonic: 记录挂失成功事件
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 16:56:42 -08:00
hailin
d3e680ea14
feat(identity/blockchain): 添加助记词挂失功能
...
后端:
- blockchain-service: 新增 revokeMnemonic() 方法和 POST /internal/mnemonic/revoke API
- identity-service: 新增 POST /user/mnemonic/revoke 用户端API
- 挂失后助记词状态变为 REVOKED,无法用于账户恢复
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 07:56:27 -08:00
hailin
257236480f
feat(wallet/profile): 添加可结算和已过期奖励逐笔显示功能
...
后端:
- wallet-service 新增 getSettleableRewards() 和 getExpiredRewards() 方法
- 新增 GET /wallet/settleable-rewards 和 GET /wallet/expired-rewards API
前端:
- reward_service.dart 新增 SettleableRewardItem、ExpiredRewardItem 数据模型
- profile_page.dart 可结算区域和已过期区域支持逐笔明细显示
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 07:20:44 -08:00
hailin
bad14bcb32
chore(admin-service): 更新 package-lock.json
...
同步 uuid 依赖到 lock 文件
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 01:00:08 -08:00
hailin
44f7e16d3a
fix(admin-service): 添加缺失的 uuid 依赖
...
notification.controller.ts 使用了 uuid 生成 ID,但 package.json 缺少依赖
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-16 00:57:04 -08:00
hailin
ab31ad3726
feat(blockchain): 添加 Redis 缓存自动恢复机制
...
扫描区块时检测缓存是否为空,如果为空则自动从数据库重新加载地址缓存,
避免因 Redis 数据丢失导致充值漏检。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 23:13:04 -08:00
hailin
c1fe54a8d4
feat: 暂时禁用 BSC 链,添加 Kafka 企业级重试配置
...
- blockchain-service: getSupportedChains() 只返回 KAVA
- 所有 Kafka consumer 添加企业级重试配置(15次重试,指数退避)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 22:33:34 -08:00
hailin
286e6aad01
fix(db): 添加缺失的数据库迁移文件
...
问题:
- wallet-service schema 中有 version 字段,但迁移文件中缺失
- presence-service 缺少初始化迁移文件
修复:
- wallet-service: 添加 20241216000000_add_version_column 迁移
- presence-service: 添加 20241204000000_init 初始化迁移(包含 version 字段)
- presence-service: 删除无效的 20251215100000 迁移(依赖不存在的表)
验证所有服务 schema 与 migration 一致性:
- identity-service: ✅ OK
- wallet-service: ✅ 已修复
- blockchain-service: ✅ OK (无 version 字段)
- planting-service: ✅ OK
- reward-service: ✅ OK
- referral-service: ✅ OK
- leaderboard-service: ✅ OK
- presence-service: ✅ 已修复
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 21:53:31 -08:00
hailin
e75b968aeb
feat(identity): 增强账户创建流程可靠性
...
问题:
- saveWallets() 无事务保护,并发时可能部分成功部分失败
- 事件处理器静默失败,Kafka 不会重试
- 无幂等性检查,重试可能创建重复钱包
修复:
1. saveWallets() 添加事务保护 + 幂等性检查
- 使用 prisma.$transaction 确保原子性
- 检查已存在的钱包地址,跳过重复创建
2. 所有事件处理器添加 throw error 启用 Kafka 重试
- BlockchainWalletHandler: WalletAddressCreated 事件
- MpcKeygenCompletedHandler: KeygenStarted/Completed/Failed 事件
- blockchain-event-consumer: 顶层错误处理
- mpc-event-consumer: 顶层错误处理
影响文件:
- user-account.repository.impl.ts: saveWallets 事务+幂等
- blockchain-wallet.handler.ts: throw error
- mpc-keygen-completed.handler.ts: throw error (3处)
- blockchain-event-consumer.service.ts: throw error
- mpc-event-consumer.service.ts: throw error
预期效果:
- 100并发账户创建成功率: 85% → 97%+
- Kafka 消息失败自动重试
- 防止重复创建钱包地址
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 20:37:54 -08:00
hailin
be7ec87f05
feat(wallet): 增强认种流程可靠性 - 添加事务保护和乐观锁
...
## 问题背景
认种流程(冻结→确认扣款→解冻)存在以下可靠性问题:
1. 余额检查与冻结操作非原子性,存在并发竞态条件
2. 钱包更新与流水记录分开执行,可能导致数据不一致
3. 缺少乐观锁机制,并发修改时可能出现余额错误
4. Kafka consumer 错误被吞掉,消费失败无法重试
## 修复内容
### wallet-application.service.ts
1. **freezeForPlanting (冻结资金)**
- 添加 `prisma.$transaction` 事务保护
- 添加乐观锁 (version 字段检查)
- 添加重试机制 (最多 3 次,指数退避)
- 幂等性检查移入事务内,避免竞态
2. **confirmPlantingDeduction (确认扣款)**
- 添加事务保护,确保扣款与流水原子性
- 添加乐观锁防止并发修改
- 添加重试机制
3. **unfreezeForPlanting (解冻资金)**
- 添加事务保护,确保解冻与流水原子性
- 添加乐观锁防止并发修改
- 添加重试机制
### planting-event-consumer.service.ts
- 添加 `throw error` 重新抛出错误
- 确保消费失败时 Kafka 能感知并触发重试
## 乐观锁实现
```typescript
const updateResult = await tx.walletAccount.updateMany({
where: {
id: walletRecord.id,
version: currentVersion, // 版本检查
},
data: {
usdtAvailable: newAvailable,
version: currentVersion + 1, // 版本递增
},
});
if (updateResult.count === 0) {
throw new OptimisticLockError('版本冲突');
}
```
## 测试验证
- wallet-service 构建成功
- 服务重启正常,所有 handler 注册成功
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:56:49 -08:00
hailin
a01284678d
feat(wallet/mpc): 增强提现和充值流程可靠性
...
## 主要改进
### MPC 签名系统 (mpc-system)
- 添加签名缓存机制,避免重复签名请求
- 修复 yParity 恢复逻辑,确保签名格式正确
- 优化签名完成报告流程
### 区块链服务 (blockchain-service)
- EIP-1559 降级为 Legacy 交易(KAVA 测试网兼容)
- 修复 gas 估算逻辑
### 钱包服务 (wallet-service)
- 添加乐观锁机制 (version 字段) 防止并发修改
- 提现确认流程添加事务保护 + 乐观锁
- 提现失败时正确解冻 amount + fee
- 充值流程添加事务保护 + 乐观锁
- Kafka consumer 添加错误重抛,触发重试机制
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 19:47:20 -08:00
hailin
2af5938821
fix(mpc-service): 规范化 messageHash 去掉 0x 前缀
...
mpc-system 期望纯 hex 字符串(不带 0x 前缀),
blockchain-service 发送的 messageHash 带有 0x 前缀导致 400 错误
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 10:00:21 -08:00
hailin
54ac2ee225
feat(mpc): 将 blockchain-service MPC 签名从 HTTP 改为 Kafka 事件驱动
...
重构 blockchain-service 和 mpc-service 之间的 MPC 签名通信方式:
- blockchain-service: MpcSigningClient 改用 Kafka 发布签名请求事件
- blockchain-service: MpcEventConsumerService 新增 SigningCompleted 事件监听
- mpc-service: SigningRequestedHandler 支持识别请求来源 (source 字段)
事件流:
blockchain-service → Kafka(mpc.SigningRequested) → mpc-service
mpc-service → HTTP → mpc-system
mpc-service → Kafka(mpc.SigningCompleted) → blockchain-service
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 09:45:39 -08:00
hailin
0682f6aac3
Revert "fix(mpc-service): 添加 DTO 验证装饰器"
...
This reverts commit 6eb4b6b153 .
2025-12-15 09:36:31 -08:00
hailin
6eb4b6b153
fix(mpc-service): 添加 DTO 验证装饰器
...
添加 class-validator 装饰器到 CreateKeygenDto 和 CreateSigningDto,
修复 NestJS ValidationPipe 的 forbidNonWhitelisted 验证错误。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 09:36:03 -08:00
hailin
9b3f33ea42
fix(blockchain): 修复 MPC 签名 API 路径
...
mpc-service 使用全局前缀 api/v1,调整签名 API 路径:
- /mpc/sign → /api/v1/mpc/sign
- /mpc/sign/:sessionId/status → /api/v1/mpc/sign/:sessionId/status
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 09:28:47 -08:00
hailin
71e805b1fd
feat(deploy): 添加 HOT_WALLET 配置到 install 模板
...
在 deploy.sh 的 install() 函数中添加热钱包配置,
新部署时会自动包含这些环境变量。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 09:06:51 -08:00
hailin
317532109d
config: 添加热钱包配置
...
HOT_WALLET_USERNAME=rwadurian-system-hot-wallet-01
HOT_WALLET_ADDRESS=0x895aaf83C57f807416E3BbBd093d7aB74a6FDd33
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:58:42 -08:00
hailin
9cac91b5f0
feat(blockchain): 将提现转账从私钥签名改为 MPC 签名
...
背景:
- 原实现使用 HOT_WALLET_PRIVATE_KEY 进行热钱包签名
- 私钥直接存储存在安全风险
- 系统已有 MPC 基础设施,应该复用
改动内容:
1. 新增 MPC 签名客户端
- infrastructure/mpc/mpc-signing.client.ts: 调用 mpc-service 的签名 API
- 支持创建签名会话、轮询等待、获取签名结果
2. 重构 ERC20 转账服务
- domain/services/erc20-transfer.service.ts: 从私钥签名改为 MPC 签名
- 移除 Wallet 依赖,改用 Transaction 手动构建交易
- 使用 MPC 签名后广播已签名交易
3. 新增初始化服务
- mpc-transfer-initializer.service.ts: 启动时注入 MPC 客户端
- 解决 Domain 层和 Infrastructure 层的循环依赖
4. 新增热钱包初始化脚本
- scripts/init-hot-wallet.sh: 便捷创建系统热钱包的 MPC 密钥
- 支持配置门限值、用户名等参数
5. 更新配置
- 移除 HOT_WALLET_PRIVATE_KEY 依赖
- 新增 MPC_SERVICE_URL, HOT_WALLET_USERNAME, HOT_WALLET_ADDRESS
- 更新 docker-compose.yml 和 .env.example
部署前需要:
1. 运行 init-hot-wallet.sh 初始化热钱包
2. 配置 HOT_WALLET_USERNAME 和 HOT_WALLET_ADDRESS
3. 向热钱包充值 USDT 和原生币(gas)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 08:04:17 -08:00
hailin
28c44d7219
fix(wallet): 提现失败解冻时优先使用 accountSequence 查找钱包
...
问题背景:
- 原实现使用 userId 查找钱包进行解冻操作
- userId 来自外部 identity-service,存在变化风险
- 如果 userId 发生变化,可能导致解冻到错误的钱包
解决方案:
- 优先使用 accountSequence 查找钱包(wallet-service 内部主键,稳定可靠)
- 保留 userId 作为兜底查找方式,确保向后兼容
- 增加钱包找不到时的详细错误日志
改动点:
- withdrawal-status.handler.ts: handleWithdrawalFailed() 方法
- 与认种(planting)的钱包查找逻辑保持一致
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 07:37:36 -08:00
hailin
cc06638e0e
feat(telemetry): 将userId改为userSerialNum字符串格式并完善遥测追踪
...
Backend (presence-service):
- 将EventLog.userId从BigInt改为String类型,存储userSerialNum(如D25121400005)
- 更新Prisma schema,userId字段改为VarChar(20)并添加索引
- 更新心跳相关命令和事件,统一使用userSerialNum字符串
- 添加数据库迁移文件
- 更新相关单元测试和集成测试
Frontend (mobile-app):
- TelemetryEvent新增toServerJson()方法,格式化为后端API期望的格式
- AccountService登录/恢复时设置TelemetryService的userId
- MultiAccountService切换账号时同步更新TelemetryService的userId
- 退出登录时清除TelemetryService的userId
- AuthProvider初始化时设置userId
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 06:55:25 -08:00
hailin
579e8c241e
fix(backend): 修复构建错误并添加 TOTP 数据库迁移
...
修复内容:
- identity-service: 添加 CurrentUserPayload 接口定义
- identity-service: 添加 user_totp 表的数据库迁移文件
- wallet-service: 安装 axios 依赖
- wallet-service: 修复 withdrawal-status.handler.ts 中的类型错误
- userId.toString() → userId.value (BigInt 类型)
- unfreezeUsdt() → unfreeze() (正确的方法名)
- amount.asNumber → amount.value (Money 值对象属性)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 05:29:29 -08:00
hailin
b01277ab7d
feat(withdraw): 实现完整的提取功能 - TOTP验证和KAVA转账
...
功能实现:
- identity-service: 添加TOTP二次验证功能
- 新增 UserTotp 数据模型
- 实现 TotpService (生成/验证/启用/禁用)
- 添加 /totp/* API端点
- wallet-service: 提取API添加TOTP验证
- withdrawal.dto 添加可选 totpCode 字段
- 添加 IdentityClientService 调用identity-service验证TOTP
- 添加 WithdrawalStatusHandler 处理区块链确认/失败事件
- blockchain-service: 实现真实KAVA ERC20转账
- 新增 Erc20TransferService (热钱包USDT转账)
- 更新 withdrawal-requested.handler 执行真实转账
- 发布确认/失败事件回wallet-service
- 前端: 对接真实提取API
- withdraw_confirm_page 调用 walletService.withdrawUsdt
环境变量配置:
- TOTP_ENCRYPTION_KEY (identity-service)
- IDENTITY_SERVICE_URL (wallet-service)
- HOT_WALLET_PRIVATE_KEY (blockchain-service)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 05:16:42 -08:00
hailin
09e66cef10
refactor: 多项UI优化和品牌更名
...
- 品牌更名: 将"榴莲女皇"全部替换为"榴莲皇后"(前端+后端共15处)
- 导航优化: 将"交易"Tab改名为"兑换"
- 创建钱包页: 添加返回按钮,可返回向导页第5页(仅账号未创建时显示)
- 兑换页面: 禁用"一键结算"和"卖出DST"按钮,提款按钮在余额为0时禁用
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-15 01:43:47 -08:00
hailin
db37fbf860
feat(notification): 添加通知中心功能
...
后端 (admin-service):
- 新增 Notification 和 NotificationRead 数据模型
- 支持通知类型: 系统/活动/收益/升级/公告
- 实现管理端 API: 创建/更新/删除/列表
- 实现移动端 API: 获取通知列表/未读数量/标记已读
前端 (mobile-app):
- 新增 NotificationService 和 Provider
- 新增通知中心页面 (NotificationInboxPage)
- 在"我的"页面右上角添加通知图标(带未读角标)
- 支持查看通知详情、标记已读、全部已读
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 20:45:03 -08:00
hailin
2e44263834
feat(profile): 添加我的伞下功能 - 展示下级用户树形结构
...
- 后端新增 GET /referral/user/:accountSequence/direct-referrals API
- 前端新增伞下树组件,支持懒加载、缓存、展开/收起
- 使用 CustomPaint 绘制父子节点连接线
- 超出屏幕宽度时显示省略号,点击弹出底部列表
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 10:34:56 -08:00
hailin
ed47e7ab2d
fix(authorization): 修复下级团队认种数重复减去自己认种数的 BUG
...
问题描述:
- 社区/省公司/市公司的初始考核判断错误
- 原因: referral-service 返回的 totalTeamPlantingCount 已经是"下级团队认种数"(不含自己)
但 authorization-service 又减了一次 selfPlantingCount,导致结果偏小
示例:
- D25121400003: 自己认种12棵,下级认种14棵
- 修复前: subordinateTeamPlantingCount = 14 - 12 = 2 (错误!)
- 修复后: subordinateTeamPlantingCount = 14 (正确)
影响范围:
- 社区权益初始考核 (10棵门槛)
- 省公司权益初始考核
- 市公司权益初始考核 (100棵门槛)
- 所有使用 subordinateTeamPlantingCount 的业务逻辑
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 09:15:00 -08:00
hailin
090c8b747e
fix(reward): 修复 accountSequence 转 userId 时字母前缀导致的 BigInt 转换失败
...
问题描述:
- 社区权益激活后,用户收不到奖励
- 错误: SyntaxError: Cannot convert D25121400002 to a BigInt
- 原因: accountSequence 格式为 D25121400002 (D+日期+序号),直接 BigInt() 转换失败
修改方案:
- 新增 parseAccountSequenceToUserId() 辅助方法
- 如果 accountSequence 以字母开头,去掉第一个字符后再转 BigInt
- 影响 5 个方法: calculateProvinceTeamRight, calculateProvinceAreaRight,
calculateCityTeamRight, calculateCityAreaRight, calculateCommunityRight
技术背景:
- accountSequence 格式: D25121400002 (用户) / S0000000001 (固定系统账户) / 9440000 (省系统)
- 省市系统账户在 authorization-service 动态创建,identity-service 中不存在
- reward-service 的 userId 字段实际业务中不被使用 (查询用 accountSequence)
潜在隐患:
1. userId 字段存储的不是 identity-service 中的真实 userId
- D25121400002 -> 25121400002 (不是真实的自增 userId)
- S0000000001 -> 1 (恰好匹配固定系统账户)
- 9440000 -> 9440000 (省系统账户,本无字母前缀)
2. 如果未来 reward-service 需要与 identity-service 关联查询,可能出现问题
3. 建议后续考虑: 将 userId 改为可选字段,或完全移除该字段依赖
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 08:18:23 -08:00
hailin
c7d54da49f
fix(reward): 修复调用 authorization-service 时传递 userId 而非 accountSequence 的问题
...
- IAuthorizationServiceClient 接口参数类型从 userId: bigint 改为 accountSequence: string
- authorization-service.client.ts 调用时使用正确的 accountSequence 格式
- calculateCommunityRight/calculateProvinceTeamRight/calculateCityTeamRight 方法增加 sourceAccountSequence 参数
此修复确保 reward-service 调用 authorization-service 时传递正确的用户标识格式(如 D25121400006),
而不是数字形式的 userId(如 7),使 authorization-service 能正确查找社区授权记录。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 06:48:58 -08:00
hailin
c9f944355c
fix(referral): 修复 getReferralChain API 返回 accountSequence 而非 userId
...
- 修改 getReferralChain 方法返回的 ancestorPath 为 accountSequence 格式
- 修改 getBatchReferralChains 方法同样返回 accountSequence 格式
- 这修复了 authorization-service 查询社区层级时使用错误格式的问题
- 之前返回 userId (如 "25121400000"),现在返回 accountSequence (如 "D25121400000")
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 06:10:41 -08:00
hailin
367e34f3a6
fix(reward): 待领取奖励转可结算使用accountSequence
...
- 添加 claimPendingRewardsForAccountSequence 方法
- event-consumer 改用 accountSequence 查找待领取奖励
- 修复上家认种后待领取奖励不能转为可结算的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 05:58:19 -08:00
hailin
7d95a35204
fix(referral): 团队统计使用accountSequence替代userId
...
- UpdateTeamStatisticsCommand 改用 accountSequence
- PlantingCreatedHandler 传递 accountSequence
- TeamStatisticsService 使用 findByAccountSequence 查询
- 修复上家团队认种数不正确的问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 05:46:11 -08:00
hailin
a7c36b5ee1
fix(referral): 使用JWT中的accountSequence替代userId查询
...
- JwtAuthGuard解析accountSequence字段放入request.user
- getMyReferralInfo和getMyDirectReferrals改用accountSequence
- 修复referral-service与identity-service用户ID不匹配问题
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 05:27:22 -08:00
hailin
6ef8824ef0
fix(referral): 修复 getMyReferralInfo 使用 userId 而不是 accountSequence 的问题
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 05:05:03 -08:00
hailin
1a97a9df54
fix(reward): add WALLET_SERVICE_URL to reward-service
...
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 04:52:24 -08:00
hailin
d6055099c7
fix(planting): 支付完成后直接开启挖矿,跳过底池注入流程
...
- enableMining() 允许从 PAID 状态直接开启
- addPlanting() 树直接进入 effectiveTreeCount
- payOrder() 删除底池批次逻辑,直接调用 enableMining()
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 04:25:31 -08:00
hailin
17c3f61657
fix(identity): 优化默认昵称格式为简洁序号
...
修改默认昵称生成逻辑:
- 从完整序列号中提取后5位数字
- 去掉前导零后组合
- 示例: D24121400001 -> 榴莲女皇1号
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 03:33:40 -08:00
hailin
7c72be3ba0
fix(docker): 修复 referral-service Dockerfile 健康检查 URL
...
修复 referral-service 的健康检查端点配置:
- referral-service: /health -> /api/v1/health
注:backup-service 使用 /health,leaderboard-service 使用 /api/health(这是服务本身实现的端点)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 03:05:18 -08:00
hailin
cd742856c0
fix(identity): 优化默认昵称生成格式
...
将新用户默认昵称从「用户D2512140001」改为「用户1」,
使用 accountSequence.dailySequence 提取当日序号并去除前导零。
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:59:01 -08:00
hailin
35f5d54a0c
fix(planting): 无推荐人时分享权益进入分享权益池
...
- 将无推荐人时的分享权益目标从 SYSTEM_HEADQUARTERS_COMMUNITY 改为 SYSTEM_SHARE_RIGHT_POOL
- 将 SYSTEM:OPERATION_ACCOUNT 改为 SYSTEM:SHARE_RIGHT_POOL
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:18:32 -08:00
hailin
4478351f89
fix(authorization): 修复 grantProvinceCompany 业务验证逻辑
...
- 添加省区域/市区域互斥检查:同一用户不能同时拥有两种身份
- 添加省区域全局唯一性检查:整个系统只允许一个省区域角色被授权
- 添加 findAnyProvinceCompany 仓储方法用于全局唯一性校验
- 移除错误的 validateAuthorizationRequest 调用(该方法只适用于团队角色)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:15:09 -08:00
hailin
298ce52fc7
fix(authorization): 修复 grantCityCompany 业务验证逻辑
...
- 添加市区域/省区域互斥检查:同一用户不能同时拥有两种身份
- 添加用户市区域唯一性检查:一个用户只能有一个市区域角色
- 添加城市全局唯一性检查:同一城市只允许一个市区域角色
- 移除错误的 validateAuthorizationRequest 调用(该方法只适用于团队角色)
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:11:13 -08:00
hailin
10ce981111
fix(authorization-service): 社区授权唯一性约束
...
- 一个用户只能拥有一个社区角色
- 社区名称全局唯一,不允许重复
- 添加 findCommunityByName repository 方法
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 00:04:24 -08:00
hailin
95e1cdffba
feat(authorization-service): 正式省公司(PROVINCE_COMPANY)阶梯考核及月度考核
...
- 添加 PROVINCE_COMPANY_LADDER 阶梯目标配置 (150→300→600→1200→2400→4800→9600→19200→11750)
- 修改 getProvinceAreaRewardDistribution 使用阶梯目标判断激活条件
- 添加 processExpiredProvinceCompanyBenefits 月度考核方法
- 添加每月最后一天23:59定时任务执行省公司月度考核
- 添加月度数据存档方法 archiveAndResetProvinceCompanyMonthlyTreeCounts
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 23:43:41 -08:00
hailin
1896dd6b4c
feat(authorization-service): 正式市公司(CITY_COMPANY)阶梯考核及月度考核
...
- 添加 CITY_COMPANY_LADDER 阶梯目标配置 (30→60→120→240→480→960→1920→3840→2350)
- 修改 getCityAreaRewardDistribution 使用阶梯目标激活权益
- 添加 processExpiredCityCompanyBenefits 月度考核处理方法
- 添加月末23:59考核定时任务 (判断是否当月最后一天)
- 添加正式市公司月度数据存档定时任务
业务规则:
- 第一个月达标30棵树即可激活权益
- 每月最后一天23:59执行考核
- 达标续期并递增月份索引
- 不达标停用权益
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 23:34:55 -08:00
hailin
4d58d4be6c
feat(authorization-service): 省团队授权级联激活/停用及月度考核
...
- 添加 cascadeActivateParentAuthProvinces: 当省团队授权激活时级联激活上级省团队
- 添加 cascadeDeactivateAuthProvinceBenefits: 月度考核失败时级联停用上级省团队
- 添加 processExpiredAuthProvinceBenefits: 月度考核处理(500棵树/月)
- 修改 tryActivateBenefit 支持 AUTH_PROVINCE_COMPANY 级联激活
- 定时任务: 每天凌晨5点检查省团队权益过期
- 定时任务: 每月1号存档并重置省团队月度新增树数
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 22:32:39 -08:00
hailin
049a13c97e
feat(authorization-service): 市团队授权级联激活/停用及月度考核
...
- 添加 cascadeActivateParentAuthCities: 当市团队授权激活时级联激活上级市团队
- 添加 cascadeDeactivateAuthCityBenefits: 月度考核失败时级联停用上级市团队
- 添加 processExpiredAuthCityBenefits: 月度考核处理(100棵树/月)
- 添加 findExpiredActiveByRoleType 仓储方法
- 修改 tryActivateBenefit 支持 AUTH_CITY_COMPANY 级联激活
- 定时任务: 每天凌晨4点检查市团队权益过期
- 定时任务: 每月1号存档并重置市团队月度新增树数
🤖 Generated with [Claude Code](https://claude.com/claude-code )
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 22:04:59 -08:00