Commit Graph

676 Commits

Author SHA1 Message Date
hailin 582e80b750 fix(pending-actions): add @Public() decorator to AdminPendingActionController
Skip JWT auth for admin pending-actions endpoints since admin-web
authenticates through a different mechanism (admin-service tokens).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 19:00:24 -08:00
hailin 28e0396a65 feat(pending-actions): add user pending actions system
Add a fully optional pending actions system that allows admins to configure
specific tasks that users must complete after login.

Backend (identity-service):
- Add UserPendingAction model to Prisma schema
- Add migration for user_pending_actions table
- Add PendingActionService with full CRUD operations
- Add user-facing API (GET list, POST complete)
- Add admin API (CRUD, batch create)

Admin Web:
- Add pending actions management page
- Support single/batch create, edit, cancel, delete
- View action details including completion time
- Filter by userId, actionCode, status

Flutter Mobile App:
- Add PendingActionService and PendingActionCheckService
- Add PendingActionsPage for forced task execution
- Integrate into splash_page login flow
- Users must complete all pending tasks in priority order

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 18:22:51 -08:00
hailin 04a8c56ad6 fix(identity): use correct Aliyun API for ID card verification
Change API from Id2MetaStandardVerify to Id2MetaVerify for two-factor
identity verification (name + ID card number). The previous API was
returning error 440 (no permission).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 08:05:08 -08:00
hailin e2cf3c3d7e fix(admin-service): 修复通知查询时publishedAt为null的问题
问题:当 publishedAt 为 NULL(表示立即发布)时,Prisma 的
`publishedAt: { lte: now }` 条件不匹配,导致通知无法显示

修复:将查询条件改为 OR 逻辑:
- publishedAt 为 null(立即发布)
- publishedAt <= now(定时发布且已到时间)

影响的方法:
- findNotificationsForUser
- countUnreadForUser
- markAllAsRead

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 05:56:43 -08:00
hailin fea0b42223 fix(admin-service): 修复维护拦截器路径检测和错误处理
问题:添加系统维护检测后站内通知功能失效

修复:
1. 使用 request.url 获取完整路径(包含 /api/v1 前缀)
2. 同时支持带前缀和不带前缀的路径检测
3. 添加 try-catch 错误处理,数据库错误时放行请求而非阻断
4. 添加日志记录便于调试

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 05:01:32 -08:00
hailin c392142562 feat(blockchain): 切换到dUSDT(绿积分)合约 - KAVA主网
合约信息:
- 地址: 0xA9F3A35dBa8699c8C681D8db03F0c1A8CEB9D7c3
- 名称: Durian USDT (dUSDT)
- 精度: 6位
- 网络: KAVA EVM Mainnet (Chain ID: 2222)
- 链接: https://kavascan.com/address/0xA9F3A35dBa8699c8C681D8db03F0c1A8CEB9D7c3

修改:
- blockchain.config.ts: 更新默认合约地址
- chain-config.service.ts: 更新默认合约地址
- docker-compose.yml: NETWORK_MODE改为mainnet,配置KAVA主网
- .env.example: 更新合约地址和注释
- KAVA_NETWORK.md: 标注dUSDT为当前使用合约

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 04:31:11 -08:00
hailin 8173e1f973 feat: "同僚"改为"同伴" + KYC从三要素改为二要素
mobile-app:
- profile_page.dart: 将所有"同僚"改为"同伴"

identity-service:
- 层级1实名认证从三要素(姓名+身份证+手机号)改为二要素(姓名+身份证号)
- 使用阿里云 Id2MetaStandardVerify API
- 二要素验证直接调用真实API,不使用mock
- 保留三要素验证方法(verifyIdCardThreeFactor)备用

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-02 04:20:42 -08:00
hailin 0781c53101 fix(admin-service): 修复 getCurrentStatus 方法使用旧响应格式的问题
AdminMaintenanceController.getCurrentStatus() 方法仍使用旧的 inMaintenance 字段,
导致构建失败。更新为与 MobileMaintenanceController 一致的新格式:
- 使用 isUnderMaintenance 代替 inMaintenance
- 使用嵌套的 maintenance 对象包含详情
- 添加 remainingMinutes 字段计算

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 06:11:54 -08:00
hailin 75a9ffadef fix(admin-service): 修复移动端维护状态API响应格式不匹配问题
移动端期望的格式:
{
  "isUnderMaintenance": true,
  "maintenance": { "title", "message", "startTime", "endTime", "remainingMinutes" }
}

后端之前返回的格式:
{
  "inMaintenance": true,
  "title", "message", "endTime"
}

修改内容:
- 字段名 inMaintenance → isUnderMaintenance
- 嵌套维护详情到 maintenance 对象
- 添加 startTime 和 remainingMinutes 字段

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 05:10:18 -08:00
hailin 1af5780b19 fix(admin-service): 修复共管钱包 status 类型不匹配问题
使用 Prisma 生成的类型替代手动定义的接口:
- PrismaCoManagedWalletSession -> @prisma/client
- PrismaCoManagedWallet -> @prisma/client
- status 字段使用 PrismaWalletSessionStatus 枚举类型

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-28 00:02:18 -08:00
hailin e51450d9f9 chore(admin-service): 添加系统维护和共管钱包的数据库迁移
添加缺失的 migration 文件,包含:
- system_maintenances 表 (系统维护公告)
- WalletSessionStatus 枚举
- co_managed_wallet_sessions 表 (共管钱包会话)
- co_managed_wallets 表 (共管钱包记录)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 23:36:42 -08:00
hailin dc16a616a5 fix(identity-service): 修复并发auto-login请求导致的唯一约束冲突
- 在创建新token前先撤销该设备的旧token
- 使用upsert替代create避免并发时refresh_token_hash唯一约束冲突

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 23:27:21 -08:00
hailin c328d8b59b feat(mobile-app,admin): 添加系统维护功能和通知徽章功能
系统维护功能:
- 后端: 添加系统维护配置实体、仓库和控制器
- 后端: 添加维护模式拦截器,返回503状态码
- admin-web: 添加系统维护管理页面,支持创建/编辑/开关维护配置
- mobile-app: 添加维护状态检查服务和阻断弹窗
- mobile-app: 在启动页、向导页集成维护检查
- mobile-app: 支持App从后台恢复时自动检查维护状态

通知徽章功能:
- 添加通知徽章Provider,监听登录状态自动刷新
- 底部导航栏"我的"标签显示未读通知红点
- 进入通知页面自动刷新徽章状态
- 切换账号、退出登录自动清除徽章

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 23:26:01 -08:00
hailin fea01642e7 feat(co-managed-wallet): 添加分布式多方共管钱包创建功能
## 功能概述
实现分布式多方共管钱包创建功能,包括 Admin-Web 扩展和 Service-Party 桌面应用。

## 主要变更

### 1. Admin-Web 扩展 (前端)
- 新增 CoManagedWalletSection 组件 (frontend/admin-web/src/components/features/co-managed-wallet/)
- 在授权管理页面添加共管钱包入口卡片
- 实现创建钱包向导: 配置 → 邀请 → 生成 → 完成
- 包含组件: ThresholdConfig, InviteQRCode, ParticipantList, SessionProgress, WalletResult

### 2. Admin-Service 后端 API
- 新增共管钱包领域实体和枚举 (domain/entities/co-managed-wallet.entity.ts)
- 新增 REST 控制器 (api/controllers/co-managed-wallet.controller.ts)
- 新增服务层 (application/services/co-managed-wallet.service.ts)
- 新增 Prisma 模型: CoManagedWalletSession, CoManagedWallet
- 更新 app.module.ts 注册新模块

### 3. Session Coordinator 扩展 (Go)
- 新增会话类型: SessionTypeCoManagedKeygen ("co_managed_keygen")
- 扩展 MPCSession 实体添加 WalletName 和 InviteCode 字段
- 更新 PostgreSQL 和 Redis 适配器支持新字段
- 新增数据库迁移: 008_add_co_managed_wallet_fields

### 4. Service-Party 桌面应用 (新项目)
- 位置: backend/mpc-system/services/service-party-app/
- 技术栈: Electron + React + TypeScript + Vite
- 包含模块:
  - gRPC 客户端 (连接 Message Router)
  - TSS 处理器 (子进程方式运行 Go TSS 协议)
  - 本地加密存储 (AES-256-GCM)
- 页面: Home, Join, Create, Session, Settings

## 修改的现有文件 (便于回滚)

1. backend/mpc-system/services/session-coordinator/domain/entities/mpc_session.go
   - 添加 SessionTypeCoManagedKeygen 常量
   - 添加 IsKeygen() 方法
   - 添加 WalletName, InviteCode 字段
   - 更新 ReconstructSession, ToDTO, SessionDTO

2. backend/mpc-system/services/session-coordinator/adapters/output/postgres/session_postgres_repo.go
   - 更新 SQL 查询包含 wallet_name, invite_code
   - 更新 Save, FindByUUID, FindByStatus 等方法
   - 更新 scanSessions, sessionRow

3. backend/mpc-system/services/session-coordinator/adapters/output/redis/session_cache_adapter.go
   - 更新 sessionCacheEntry 结构
   - 更新 sessionToCacheEntry, cacheEntryToSession

4. backend/services/admin-service/prisma/schema.prisma
   - 新增 WalletSessionStatus 枚举
   - 新增 CoManagedWalletSession, CoManagedWallet 模型

5. backend/services/admin-service/src/app.module.ts
   - 导入并注册共管钱包相关组件

6. frontend/admin-web/src/app/(dashboard)/authorization/page.tsx
   - 导入并添加 CoManagedWalletSection

7. frontend/admin-web/src/infrastructure/api/endpoints.ts
   - 添加 CO_MANAGED_WALLETS API 端点

## 回滚说明

如需回滚此功能:
1. 回滚数据库迁移: 运行 008_add_co_managed_wallet_fields.down.sql
2. 删除新增文件夹:
   - backend/mpc-system/services/service-party-app/
   - frontend/admin-web/src/components/features/co-managed-wallet/
   - backend/services/admin-service/src/**/co-managed-wallet*
3. 恢复修改的文件到前一个版本
4. 运行 prisma generate 重新生成 Prisma 客户端

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 21:39:07 -08:00
hailin fe593714ae fix(admin-service): 修复上传版本时isForceUpdate始终为true的问题
问题原因:
- ValidationPipe配置了enableImplicitConversion: true
- FormData发送字符串"false"时,Boolean("false")被隐式转换为true
- @Transform装饰器在隐式转换之后执行,收到的value已经是true

解决方案:
- 在@Transform中使用obj参数获取原始未转换的值
- 手动判断字符串"true"/"false"并正确转换为布尔值

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:31:47 -08:00
hailin 058849dc2c fix(admin-service): 修复上传版本时isForceUpdate默认为true的问题
- 改进Transform装饰器,正确处理FormData传递的字符串"false"
- 添加调试日志用于排查问题

问题原因:FormData传递的布尔值会被转为字符串,
原来的Transform可能在某些情况下处理不正确

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 19:21:48 -08:00
hailin 1694f37e91 fix(mobile-app): 修复多账号切换后账号列表只显示一个的问题
- phone_login_page: 登录成功后添加账号到多账号列表
- import_mnemonic_page: 恢复账号后添加到多账号列表
- sms_verify_page: 短信验证登录后添加账号到多账号列表

问题原因:多个登录入口没有调用 addAccount() 将账号添加到列表

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 11:12:50 -08:00
hailin 339f95f7ed fix(identity-service): 修复手动重试钱包生成使用错误的事件类型
retryWalletGeneration 方法之前使用 createWalletGenerationEvent()
发布 UserAccountCreatedEvent,但 MPC 服务只监听 MpcKeygenRequestedEvent。

现在改为直接发布 MpcKeygenRequestedEvent,与 wallet-retry.task.ts 保持一致。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 10:15:30 -08:00
hailin 9153ba3625 fix(identity-service): 修复钱包重试发布错误事件类型的问题
问题:
- 重试代码使用 createWalletGenerationEvent() 发布 UserAccountCreatedEvent
- 该事件发布到 identity.UserAccountCreated topic
- 但 MPC 服务监听的是 mpc.KeygenRequested topic
- 导致重试触发成功但钱包不会被生成

修复:
- triggerWalletRetryAsync: 改为发布 MpcKeygenRequestedEvent
- WalletRetryTask.retryWalletGeneration: 改为发布 MpcKeygenRequestedEvent
- 与注册流程使用相同的事件类型和参数格式

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 10:09:20 -08:00
hailin 6216a1563a fix(identity-service): 修复动态import导致的模块解析错误
将动态 import('@/domain/value-objects') 改为静态 import

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:58:23 -08:00
hailin e742a360ec fix(identity-service): 限制定时任务每次最多触发10个重试,防止MPC过载
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:42:56 -08:00
hailin 55bb129477 feat(identity-service): 增强钱包生成可靠性,确保100%生成成功
核心改进:
- 基于数据库扫描代替Redis扫描,防止状态丢失后无法重试
- 指数退避策略(1分钟→60分钟),无时间限制持续重试
- 分布式锁保护,防止多实例/并发重复触发
- getWalletStatus API 检测失败状态并自动触发重试

修改内容:
- RedisService: 添加 tryLock/unlock 分布式锁方法
- UserAccountRepository: 添加 findUsersWithIncompleteWallets 查询
- getWalletStatus: 增强状态检测,失败/超时时自动触发重试
- WalletRetryTask: 完全重写,基于数据库驱动+指数退避

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 09:40:51 -08:00
hailin aa180c54bc fix(identity-service): 修复钱包重试逻辑,超时状态允许强制重试
之前手动重试时如果状态是 generating/pending/deriving 会直接跳过,
导致卡住的钱包无法重新生成。现在增加超时检查(60秒),超时后允许强制重试。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 11:43:02 -08:00
hailin abc3b358a7 feat(referral): 将推荐链最大深度从10层提升到1000层
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 10:26:52 -08:00
hailin e9b2917561 fix(pdf-generator): 使用自定义外观流嵌入签名图片
- 恢复使用 widget.setNormalAppearance() 方式
- 创建 XObject Form 作为外观流
- 签名图片按字段尺寸等比例缩放并居中
- 不依赖页面索引,直接设置到widget上

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 07:58:44 -08:00
hailin 91d3e65289 fix(pdf-generator): 使用page.drawImage在按钮位置绘制签名图片
- 从git历史恢复正确的签名嵌入实现
- 获取signature按钮的widget和rectangle位置
- 按字段尺寸等比例缩放签名图片并居中
- 使用page.drawImage()绘制签名,而非setImage()

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 07:54:17 -08:00
hailin 0e85c2fd23 fix(wallet-service): 修复社区权益根据 targetId 正确分配
问题:社区权益(COMMUNITY_RIGHT)无论 targetId 是什么,都强制分配到
总部账户 S0000000001,导致社区授权人无法在流水明细中看到社区权益。

修复:
- 将 allocateToHeadquartersCommunity 方法重命名为 allocateCommunityRight
- 根据 targetId 判断分配目标:
  - D 开头(用户账户): 分配到社区授权人账户
  - S 开头或 '1'(系统账户): 分配到总部社区账户
- 更新流水备注以区分用户分配和总部分配

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 07:20:22 -08:00
hailin 954f170bd4 feat(contract-signing): 增强签名功能
前端改进:
- 签名页面添加红色醒目提示"请使用正楷书写您的真实姓名"
- 签名前显示用户真实姓名供参照
- 实现全屏横向签名面板(自动切换横屏/竖屏)
- 记录签名轨迹数据(每个点的坐标和时间戳、笔画顺序)

后端改进:
- 扩展SignContractParams接口支持signatureTrace字段
- 控制器记录签名轨迹日志(笔画数、总时长)
- 签名轨迹数据以JSON格式存储,作为法律凭证

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 06:42:15 -08:00
hailin d4763ea5bf chore(planting-service): 更新合同PDF模板(修复红色文字)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 06:29:08 -08:00
hailin dfecdc06e9 chore(planting-service): 更新合同PDF模板
使用新的榴莲树认种权益协议_发布版_form.pdf替换原模板

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 06:15:49 -08:00
hailin ad5b153fa9 fix(pdf-generator): 签名按字段尺寸等比例缩放并居中
- 计算宽度和高度的缩放比例,取较小值确保签名完全在字段内
- 在字段内居中放置签名图片
- 符合行业标准:签名根据字段尺寸自适应缩放

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:56:38 -08:00
hailin 2e65a92e04 fix(planting-service): 签名图片按比例缩放到合适大小
- 目标宽度 150pt(约 5cm)
- 保持宽高比不变
- 避免签名图片过大

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:53:51 -08:00
hailin 6c017d2086 fix(planting-service): 签名图片保持原始尺寸放置
- 不再缩放签名图片适应按钮大小
- 直接在按钮位置绘制原始尺寸的签名
- 避免签名被压扁变形

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:53:22 -08:00
hailin 666be6ea60 fix(planting-service): 签名后查看合同返回已签名的PDF
- 修改 /tasks/:orderNo/pdf 接口,检查任务状态
- 如果已签名且有 signedPdfUrl,从 MinIO 下载已签名的 PDF
- 添加 downloadSignedPdf 方法到 MinioStorageService
- 在 ContractSigningTaskDto 中添加 signedPdfUrl 字段

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:48:22 -08:00
hailin 86103e4c4d fix(planting-service): 使用自定义外观流嵌入签名图片
- setImage 无法正确渲染签名到按钮字段
- 手动创建 XObject Form 外观流
- 计算图片缩放和居中位置
- 设置 widget 的 NormalAppearance

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:35:58 -08:00
hailin bdeff3b372 fix(planting-service): 修复合同签名无法放到指定位置的问题
- 修改 generateSignedContractPdf 在同一个 PDFDocument 实例上完成填充和签名
- 移除 fillFormFields 中的 form.flatten(),保留签名字段供后续使用
- 最后统一扁平化所有表单字段,确保签名放到正确位置
- 控制器改用 generateSignedContractPdf 替代分两步调用

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 05:23:53 -08:00
hailin 09cc696efa Revert "fix(wallet-service): 社区权益按 targetId 分配到正确账户"
This reverts commit 43a0e5f5e1.
2025-12-26 04:52:01 -08:00
hailin 43a0e5f5e1 fix(wallet-service): 社区权益按 targetId 分配到正确账户
修复社区权益分配逻辑:
- 之前所有 COMMUNITY_RIGHT 都直接进入总部账户 S0000000001
- 现在根据 targetId 判断:
  - targetId 为 '1' 或 'S0000000001' → 进入总部社区账户
  - targetId 为用户账户(D开头)→ 进入该用户可结算余额

这样当用户获取社区授权且伞下认种达到10棵后,
社区权益会正确分配到该用户账户,而不是总部。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:49:10 -08:00
hailin 3f3309e62f debug: 添加流水明细 allocationType 调试日志
- 后端 wallet-service: getMyLedger 打印 payloadJson 和 allocationType
- 前端 wallet_service: 打印原始和解析后的流水数据
- 前端 ledger_detail_page: 打印加载的流水数据详情

用于排查权益类型(社区、省市团队/区域)不显示的问题

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:35:46 -08:00
hailin 3d42c3602d fix(reward-service): 权益分配memo显示触发用户ID
所有权益类型的memo现在统一显示"来自用户xxx的认种"格式:
- 省团队权益:来自用户xxx的认种
- 省区域权益:来自用户xxx的认种
- 市团队权益:来自用户xxx的认种
- 市区域权益:来自用户xxx的认种
- 社区权益:来自用户xxx的认种

修改前只显示"xx权益已激活",现在与分享权益格式保持一致

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 04:18:35 -08:00
hailin f711d54eed chore(reward-service): 调整系统费用分配 - 成本费+80, 总部基础费-80 2025-12-26 04:07:41 -08:00
hailin 1d6982c73e feat(planting-service): 合同签署超时时间从24小时改为1年 2025-12-26 03:58:56 -08:00
hailin 78d7e0e637 feat(mobile-app): 流水明细支持显示权益类型和详情
- 后端 wallet-service: getMyLedger API 返回 allocationType 字段
- 前端流水明细: 显示权益类型名称(分享权益、省/市区域权益等)
- 新增权益详情弹窗,点击权益记录可查看详细信息
- 兑换页面: "RMB/CNY提现" 改为 "提现"
- 我的团队: "暂无下级成员" 改为 "暂无团队成员"
- 自助申请授权: 隐藏团队链占用区域提示

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 03:57:35 -08:00
hailin f7e2f7f6f2 fix(wallet-service): 添加 WalletAccount 类型导入 2025-12-26 02:23:49 -08:00
hailin 726e3d0fcf fix(wallet-service): 修复区域权益分配时 targetId 为用户账户导致的 BigInt 转换错误
问题:allocateToRegionAccount 假设 targetId 总是纯数字格式的区域账户,
但实际上当权益分配给授权市/省公司用户时,targetId 是 D 开头的用户账户格式。

修复:判断 targetId 格式
- D 开头:用户账户,直接 findByAccountSequence
- 纯数字:区域账户,使用 getOrCreate

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 02:20:05 -08:00
hailin 9addd99710 fix(planting-service): 修正导入路径
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:50:37 -08:00
hailin 24a46521f3 fix(planting-service): 修复跨服务调用使用错误标识符导致的500错误
问题根源:
- getBalance 调用使用 userId.toString() (纯数字如 "14")
- wallet-service 按 accountSequence 查找钱包失败后尝试创建新钱包
- 但 userId 已存在,触发唯一约束冲突导致500错误

修复内容:
1. planting-application.service.ts:
   - createOrder: getBalance(userId.toString()) → getBalance(accountSequence)
   - payOrder: getBalance(userId.toString()) → getBalance(walletIdentifier)

2. payment-compensation.service.ts:
   - 注入 IPlantingOrderRepository 获取订单的 accountSequence
   - handleUnfreeze/handleRetryConfirm 添加 accountSequence 参数

3. wallet-service.client.ts:
   - ensureRegionAccounts 接口添加 provinceTeamAccount/cityTeamAccount 字段

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:48:22 -08:00
hailin 89a2700fc9 chore(authorization-service): 移除已执行完成的 OTP 修复任务
OTP 修复结果:
- 总计处理: 3 个未激活的社区授权
- 成功修复: 1 (D25122600004)
- 跳过: 2 (未达标)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:06:32 -08:00
hailin f2a59b81ee fix(authorization-service): 修复 OTP 编译错误,使用 findByStatus 方法
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:03:54 -08:00
hailin 16a6edaf15 feat(authorization-service): 添加社区权益激活一次性修复任务
问题:由于 planting-service 发送的 userId 是订单主键而非用户真实 ID,
导致部分已达标的社区权益未被自动激活。

修复:添加 BenefitActivationFixOTP 一次性任务,在服务启动时:
1. 查找所有状态为 AUTHORIZED 但 benefitActive=false 的社区授权
2. 检查每个社区的 subordinateTeamPlantingCount 是否 >= 10
3. 满足条件则激活权益

使用方式:
1. 部署此代码,服务启动后自动执行修复
2. 确认修复完成后,删除 OTP 文件并重新部署

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 23:00:38 -08:00