hailin
|
849fa77df0
|
fix(auth-service): 允许synced_legacy_users的phone和password_hash为空
- 修改schema让phone和passwordHash字段可为空
- 添加migration: 20260111083500_allow_nullable_phone_password
- CDC consumer使用null替代空字符串
- 支持同步没有手机号/密码的系统账户
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-11 08:37:02 -08:00 |
hailin
|
6caae7c860
|
fix(auth-service): 跳过无手机号/密码的系统账户CDC同步
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-11 08:33:39 -08:00 |
hailin
|
4bb995f2c2
|
feat(auth-service,mining-app): 实现完整认证流程和CDC用户同步
auth-service:
- 添加DTO验证装饰器(IsString, IsNotEmpty, Matches, MinLength)
- 添加短信验证码登录(loginBySms)方法
- 修复CDC Consumer字段映射匹配1.0 user_accounts表
- 更新CDC topic为cdc.identity.public.user_accounts
mining-app (Flutter):
- 新增auth_remote_datasource实现真实API调用
- 新增登录页面(密码/短信切换)和注册页面
- 替换splash_page中的mock登录为真实状态检查
- 添加token自动注入拦截器到ApiClient
- 配置生产环境API指向Kong网关
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-11 05:29:48 -08:00 |
hailin
|
7f72c1e1ec
|
fix(2.0-services): 修复InfrastructureModule导出PrismaService问题
NestJS不允许模块导出未在providers中声明的服务。
将exports中的PrismaService改为PrismaModule(因为PrismaModule已导出PrismaService)。
修复服务:
- mining-admin-service
- auth-service
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-11 00:00:50 -08:00 |
hailin
|
ee5f841034
|
fix(outbox): 实现指数退避重试策略,最大延迟3小时
修复Outbox事件发布的重试机制:
1. 更新Prisma Schema (mining-service, trading-service):
- 添加OutboxStatus枚举 (PENDING, PUBLISHED, FAILED)
- 添加topic、key、status、retryCount、maxRetries、lastError等字段
- 添加publishedAt、nextRetryAt时间戳
- 优化索引 (status, nextRetryAt, createdAt)
2. 更新OutboxRepository (mining-service, trading-service):
- findPendingEvents(): 查询待处理且到达重试时间的事件
- markAsPublished(): 标记事件已发布
- markAsFailed(): 实现指数退避算法 (30s基础, 最大3小时)
- deletePublished(): 清理已发布的旧事件
3. 更新OutboxScheduler (auth/mining/trading-service):
- 使用指数退避: 30s, 60s, 120s, 240s, ... 最大10800s (3小时)
- 记录重试次数和错误信息
- 达到最大重试次数后标记为FAILED
指数退避公式: delay = min(30s * 2^(retryCount-1), 3h)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2026-01-10 21:08:57 -08:00 |
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
|
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 |