Commit Graph

1087 Commits

Author SHA1 Message Date
hailin 500e4381a6 fix(migration): 使迁移脚本幂等以支持重试
迁移脚本添加 IF NOT EXISTS 检查,避免重复执行时失败

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 05:39:38 -08:00
hailin 929ae335c5 feat(contract): 增强合同生成功能
- 添加 IdentityServiceClient 从 identity-service 获取用户 KYC 信息
- 只允许已完成实名认证的用户创建合同
- 添加 KycVerifiedEventConsumer 监听 KYC 完成事件
- 用户完成 KYC 后自动为其之前已支付的订单补创建合同
- PDF 生成器支持 AcroForm 表单字段填充(更可靠)
- 保留坐标定位方式作为后备方案
- 更新 PDF 模板为带表单字段版本

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 05:35:40 -08:00
hailin 0e93d2a343 feat(contract): 使用合同编号代替订单号
合同编号格式: accountSequence-yyyyMMddHHmm
例如: 10001-202512251003

修改内容:
- 数据库: 添加 contract_no 字段
- 后端: 聚合根、Repository、Service、PDF生成器支持 contractNo
- 前端: 显示合同编号代替订单号

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 04:58:39 -08:00
hailin 9cf1bbbbd3 fix(mobile-app): 合同签署页面添加重试机制解决竞态问题
前端在支付完成后立即请求合同签署任务,但后端 Kafka 事件可能还未完成
任务创建。添加最多5次重试,使用指数退避策略(500ms * attempt)。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 04:01:25 -08:00
hailin a7206eef2e fix(planting-service): 修复 BigInt userId 比较问题
- 使用 toString() 比较 BigInt 避免类型不匹配
- 添加调试日志帮助排查问题

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:59:27 -08:00
hailin 82ca233d54 fix(mobile-app): 签署成功后跳转到"我的"页面
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:55:23 -08:00
hailin 36e4e875bf fix(mobile-app): 修复签署成功后导航报错问题
- 签署成功后检查 canPop() 再决定返回方式
- 如果没有上一页则跳转到首页

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:54:18 -08:00
hailin 2d9e1b2d03 fix(planting-service): 修复合同签署任务创建的并发问题
- 将 upsert 改为 create + 重试机制
- 处理 P2002 唯一约束冲突时使用指数退避重试
- 确保并发创建时能正确返回已存在的记录

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:50:19 -08:00
hailin 2607907bad fix(mobile-app): 修复合同签署页面问题
- 修复 markScrollComplete/acknowledgeContract API 响应处理
  (后端返回 success:true 但无 data 时重新获取任务详情)
- 将合同签署页面的 USDT 改成绿积分

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:44:39 -08:00
hailin c657fb5a19 feat(planting-service): 实现合同签名和PDF云存储功能
- 添加 MinIO 存储服务,支持上传签名图片和已签署 PDF
- 添加 signedPdfUrl 字段到数据库模型
- 修改签署流程:生成 PDF、嵌入签名、上传到云存储
- 修复前端签署 API 响应处理

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:35:15 -08:00
hailin a2f021fe94 fix(mobile-app): 修复签署合同请求字段名与后端不匹配
- signatureImage → signatureBase64
- 添加 signatureHash 字段
- 将 deviceInfo 包装成对象格式 {deviceId, platform}
- 将 latitude/longitude 包装成 location 对象

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:20:27 -08:00
hailin accc043ff0 feat(mobile-app): 添加合同签署 API 详细调试日志
- 为 signContract、lateSignContract、markScrollComplete、acknowledgeContract 添加详细日志
- 记录请求参数(签名图片大小、IP、设备信息、位置)
- 记录响应状态码和完整响应数据
- 修复响应解析 bug:正确从 response.data['data'] 提取任务数据
- 增强错误日志,捕获堆栈信息便于调试

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:14:10 -08:00
hailin 846bf5b061 fix(mobile-app): 修复 getTask 解析响应格式错误
之前直接用 response.data 解析,应该取 response.data['data']。
这导致 expiresAt 等字段无法正确获取,倒计时每次都从 24 小时开始。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:09:31 -08:00
hailin 299de2005a fix(mobile-app): 修复待签署合同列表重复显示问题
之前同时调用 getPendingTasks 和 getUnsignedTasks 然后合并,
导致待签署的任务显示两次。现在只使用 getUnsignedTasks。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 03:07:24 -08:00
hailin cdd275479e fix(planting-service): 使用楷体 STKAITI.ttf 替换无效字体
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:56:01 -08:00
hailin 65ba75d8d1 fix(planting-service): 修复 fontkit 导入方式
使用 require 替代 ES import 解决 TypeScript 编译后 default export 问题

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:44:37 -08:00
hailin 6536ff9256 fix(planting-service): Dockerfile 添加 templates 目录复制
PDF 模板和字体文件需要复制到 Docker 容器中

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:41:22 -08:00
hailin c509daa353 feat(contract-signing): 使用 pdf-lib 实现专业 PDF 合同展示
后端改动:
- 添加 pdf-lib 和 @pdf-lib/fontkit 依赖
- 新建 PdfGeneratorService 使用 PDF 模板直接填充用户数据
- 添加中文字体支持 (NotoSansSC-Regular.ttf)
- 新增 GET /tasks/:orderNo/pdf 接口返回 PDF 文件
- 合同模板存放于 templates/contract-template.pdf

前端改动:
- 添加 flutter_pdfview 依赖
- 重写合同签署页面使用 PDFView 组件展示 PDF
- 下载 PDF 到临时目录后展示
- 滑动到最后一页自动标记已阅读

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 02:27:54 -08:00
hailin 2a85fcc7fa fix(mobile-app): 修复路由顺序避免 pending 被当成 orderNo
将 /contract-signing/pending 路由放在 /contract-signing/:orderNo 前面,
避免 GoRouter 将 "pending" 匹配为动态参数。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:08:27 -08:00
hailin c826da164c fix(mobile-app): 支付成功后跳转到合同签署页面
修改认种支付成功后的流程:
- 合同签署启用且已完成实名认证 → 跳转到合同签署页面
- 合同签署启用但未完成实名认证 → 弹窗提示去做实名认证
- 合同签署未启用 → 显示成功提示返回个人中心

符合设计流程: 支付(冻结) → 签合同 → 24小时内签署完成/超时取消

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 01:04:00 -08:00
hailin e7f2d69def fix(planting-service): 添加 P2002 错误捕获处理并发创建冲突
PostgreSQL 的 upsert 在高并发下仍可能出现唯一约束错误,
添加 try-catch 捕获 P2002 错误,发生冲突时直接查询返回已存在的记录。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:56:53 -08:00
hailin 68e269b602 fix(planting): 使用upsert解决合同签约任务创建的并发冲突
Kafka事件重复消费时,多个消费者同时创建签约任务会导致唯一约束冲突
改用upsert确保幂等性,如果orderNo已存在则返回现有记录

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:52:01 -08:00
hailin 0c6e73de85 fix(mobile-app): 修复实名认证响应解析层级错误
后端返回嵌套结构 { data: { data: {...} } },
前端需要双层解析才能获取实际数据

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:45:52 -08:00
hailin c14b87305c feat(kyc): 升级为三要素核验详版API,返回详细错误原因
- 从 Mobile3MetaSimpleVerify 改为 Mobile3MetaDetailVerify
- 新增 SubCode 详细错误码映射:
  - 201: 手机号与姓名、身份证号均不匹配
  - 202: 手机号与身份证号不匹配
  - 203: 手机号与姓名不匹配
  - 204: 其他不一致
  - 301: 查无记录

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:40:48 -08:00
hailin c3b50264cc fix(kyc): 修正阿里云手机号三要素核验的成功判断逻辑
阿里云 Mobile3MetaSimpleVerify 返回的 BizCode:
- 1: 校验一致 (成功)
- 2: 校验不一致 (失败)
- 3: 查无记录 (失败)

之前错误地将 BizCode=0 判断为成功,现改为 BizCode=1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:28:29 -08:00
hailin 4b92fb36a3 debug(kyc): 添加阿里云API返回信息的详细日志
打印完整的response和ResultObject字段以便调试

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:20:45 -08:00
hailin c2e81a6f4e fix(kyc): 使用正确的阿里云手机号三要素核验API
- 从 VerifyMaterial (身份三要素,需要人脸照片) 改为 Mobile3MetaSimpleVerify (手机号三要素)
- 手机号三要素验证:姓名 + 身份证号 + 手机号
- 添加 mapMobile3MetaErrorCode 方法映射错误码

文档: https://help.aliyun.com/zh/id-verification/information-verification/developer-reference/esf1ff158mxowkk6

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-25 00:05:03 -08:00
hailin de17231f61 fix(kyc): 为 SubmitRealNameDto 添加 class-validator 装饰器
修复 ValidationPipe whitelist 模式下属性被过滤的问题

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 23:58:55 -08:00
hailin 181d11d656 feat(kyc): 升级实名认证为三要素验证(姓名+身份证号+手机号)
- 后端 aliyun-kyc.provider.ts: 改用 ID_CARD_THREE 类型,添加 PhoneNumber 参数
- 后端 kyc-application.service.ts: 从用户账户获取手机号传递给 KYC provider
- 前端 kyc_id_page.dart: 更新文案为"三要素验证"

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 23:54:13 -08:00
hailin e4f27b3134 fix(docker): 添加阿里云KYC环境变量到docker-compose
在identity-service中添加:
- ALIYUN_KYC_ENABLED
- ALIYUN_KYC_ENDPOINT
- ALIYUN_KYC_SCENE_ID

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 23:46:12 -08:00
hailin c8396d9152 docs(identity-service): 添加阿里云KYC实人认证环境变量配置说明
在 .env.example 中添加:
- ALIYUN_KYC_ENABLED: 是否启用真实KYC验证
- ALIYUN_KYC_ENDPOINT: API端点
- ALIYUN_KYC_SCENE_ID: 人脸活体检测场景ID

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:45:29 -08:00
hailin 2edcfc3d0d fix(kyc): 修复KYC状态接口响应解析错误
后端返回的数据结构是嵌套的 data.data,修复前端解析逻辑以正确读取 phoneVerified 等字段。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:40:51 -08:00
hailin b10a158684 fix(kyc): 验证成功后刷新KYC状态
在跳转到实名认证页面前调用 ref.invalidate(kycStatusProvider)
确保手机号验证状态能正确更新

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:27:59 -08:00
hailin 1c62a8cb29 fix(kyc): 验证成功后点击完成跳转到实名认证页面
使用 context.go() 替代 context.pop(),直接跳转到实名认证页面

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:25:42 -08:00
hailin a51fa39a2d feat(kyc): 首次验证手机号成功后显示选择页面
- 添加 verifySuccess 步骤替代弹窗
- 显示"恭喜您!手机号已验证成功"
- 提供两个选择按钮:
  - "仅验证手机号,不更换" - 返回上一页
  - "继续更换手机号" - 进入输入新手机号步骤
- 已验证过的用户直接进入更换流程

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:23:13 -08:00
hailin 941253dd77 fix(frontend): 修复合同签署任务列表响应解析错误
后端返回格式为 {"success":true,"data":[]},前端错误地将 response.data 直接作为 List 解析,导致类型转换失败。

修复 getPendingTasks() 和 getUnsignedTasks() 方法,正确解析 responseData['data']。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 22:03:54 -08:00
hailin 94a5c29a09 fix(planting-service): Dockerfile复制tsconfig以支持ts-node seed
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:41:32 -08:00
hailin 8a0bff5010 fix(planting-service): Dockerfile添加自动seed步骤
启动时自动运行 prisma db seed 创建合同模板

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:29:46 -08:00
hailin 8ee65c95e1 fix(planting): 修复KycService构造函数参数
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:13:29 -08:00
hailin 59e9cddf5b feat(planting): 认种成功后检查实名认证状态
当CONTRACT_SIGNING_ENABLED=true时,认种成功后检查用户是否已完成实名认证:
- 如果未完成实名认证,显示提示弹窗引导用户去认证
- 如果已完成或功能未启用,按原有流程返回个人中心

新增:
- KycRequiredDialog 实名认证提示弹窗组件
- ContractSigningConfig 配置类和getConfig()方法
- kycServiceProvider 依赖注入

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:10:55 -08:00
hailin bc34907a84 fix(auth): 注册验证码页面显示完整手机号
验证码页面不再隐藏手机号中间数字,改为完整显示
格式: 138 1234 5678

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:03:30 -08:00
hailin 1d6cbf9335 feat(kyc): 实名认证前检查手机号验证状态
- 点击实名认证时检查手机号是否已验证
- 未验证时显示提示弹窗,引导用户先验证手机号
- 实名认证卡片显示"请先验证手机号"提示

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 21:00:53 -08:00
hailin 8b1db58318 fix(planting-service): 修复用户ID字段名与JwtAuthGuard一致
JwtAuthGuard 设置 req.user.id,controller 需要使用相同字段名

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:50:58 -08:00
hailin a7dc85d8e1 fix(frontend): 添加 geolocator 依赖并移除未使用的 webview_flutter
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:45:51 -08:00
hailin aa9370dc56 fix(planting-service): 排除 prisma 目录修复编译输出路径
prisma/seed.ts 导致 TypeScript 编译时目录结构变化,
dist/main.js 变成 dist/src/main.js

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:39:19 -08:00
hailin 80a854e9d8 chore(planting-service): 更新 package-lock.json
添加 @nestjs/schedule 依赖的锁文件

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:25:31 -08:00
hailin 33a5b79c2a fix(planting-service): 修复合同签署功能编译错误
- 修复 JwtAuthGuard 导入路径
- 添加 @nestjs/schedule 依赖

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:24:00 -08:00
hailin 5b8c6bc317 feat(frontend): 添加电子合同签署功能前端实现
- 添加 ContractSigningService 合同签署 API 调用服务
- 添加 ContractCheckService App 启动时检查待签署合同
- 添加 ContractSigningPage 完整签署流程页面
  - 24小时倒计时
  - 滚动阅读 → 确认法律效力 → 手写签名
  - 支持超时后补签
- 添加 PendingContractsPage 待签署合同列表
- 添加 SignaturePad 手写签名板组件
- HomeShellPage 启动时检查未签署合同,强制签署

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:15:13 -08:00
hailin 714ce42e4f feat(contract-signing): 添加电子合同签署功能及单点配置优化
- planting-service: 添加合同签署任务管理和超时检测
  - 新增 ContractSigningTask 领域模型
  - 添加 24 小时合同签署超时定时任务
  - 支付后资金保持冻结,由 referral-service 统一确认扣款

- referral-service: 单点配置 CONTRACT_SIGNING_ENABLED
  - 新增 ContractSigningHandler 处理合同签署/超时事件
  - 新增 WalletServiceClient 调用钱包服务确认扣款
  - planting.created 处理后根据配置决定是否等待合同签署

- reward-service: 移除 CONTRACT_SIGNING_ENABLED 配置
  - 扣款确认由 referral-service 在发送事件前完成
  - 保持奖励分配逻辑不变

配置说明:
- CONTRACT_SIGNING_ENABLED=true (默认): 等待合同签署后分配奖励
- CONTRACT_SIGNING_ENABLED=false: 立即分配奖励(原有流程)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 20:12:12 -08:00
hailin 1b3d545c0d fix(admin-web): 优化通知表单标签选择体验
- 新建通知时自动刷新可用标签列表
- 添加"刷新标签"按钮方便手动刷新
- 优化空标签提示,说明需勾选"可用于广告定向"
- 改进"指定用户"输入框占位符文本和示例

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-24 18:33:14 -08:00