Commit Graph

22 Commits

Author SHA1 Message Date
hailin 726b317c23 fix(admin-service): 修复用户事件消费时 payload 嵌套层级错误
identity-service 发布的消息结构为 { eventId, eventType, payload: {...} },
但 admin-service 消费时直接使用 eventData 而不是 eventData.payload,
导致 payload.userId 为 undefined,BigInt(undefined) 抛出异常被静默吞掉,
用户数据无法同步到 UserQueryView。

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 19:06:23 -08:00
hailin a1a9a087c5 fix(admin-service): 修复 Kafka topic 订阅不匹配问题
问题:admin-web 用户管理页面无数据
原因:admin-service 订阅的是 'identity.events',
     但 identity-service 发送到的是具体的 topic 如 'identity.UserAccountCreated'

修复:将订阅的 topics 改为与 identity-service 的 IDENTITY_TOPICS 一致:
- identity.UserAccountCreated
- identity.UserAccountAutoCreated
- identity.PhoneBound
- identity.KYCSubmitted
- identity.KYCVerified
- identity.KYCRejected
- identity.UserAccountFrozen
- identity.UserAccountDeactivated

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-21 22:40:31 -08:00
hailin f20643599e fix: 修复多个服务的 TypeScript 编译错误
- admin-service: 添加 kafkajs 依赖,修复 SystemConfigEntity null vs undefined 类型
- authorization-service: 修复 selfPlantingCount 属性名,修复 AuthorizationRole factory 参数
- identity-service: 修复测试文件 accountSequence 类型(number -> string)
- admin-web: 在 authSlice 中添加 refreshToken 支持

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 06:29:49 -08:00
hailin 943fd9efe9 chore: 提交所有未提交的修改
包括:
- admin-service: 系统配置功能
- authorization-service: 自助授权申请功能
- planting-service: 资金分配服务
- reward-service: 奖励计算服务
- admin-web: 用户管理和设置页面
- mobile-app: 授权、认证、路由等功能

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 06:09:43 -08:00
hailin ca619bff0b feat(admin): 实现用户管理功能完整前后端架构
## 概述
为 admin-web 用户管理页面实现完整的前后端架构,采用事件驱动 CQRS 模式,
通过 Kafka 事件同步用户数据到本地物化视图,避免跨服务 HTTP 调用。

## admin-service 后端变更

### 数据库 Schema
- UserQueryView: 用户查询视图表 (通过 Kafka 事件同步)
- EventConsumerOffset: 事件消费位置追踪
- ProcessedEvent: 已处理事件记录 (幂等性)

### 新增组件
- IUserQueryRepository: 用户查询仓储接口
- UserQueryRepositoryImpl: 用户查询仓储实现
- UserEventConsumerService: Kafka 事件消费者
- UserController: 用户管理 API 控制器

### API 端点
- GET /admin/users: 用户列表 (分页/筛选/排序)
- GET /admin/users/🆔 用户详情
- GET /admin/users/stats/summary: 用户统计

## identity-service 变更
- 新增 UserProfileUpdatedEvent 事件
- updateProfile 方法现在会发布事件

## admin-web 前端变更
- userService: 用户 API 服务封装
- useUsers/useUserDetail: React Query hooks
- 用户管理页面接入真实 API
- 添加加载骨架屏/错误重试/空数据提示

## 架构特点
- CQRS: 读从本地视图,写触发事件
- 事件驱动: Kafka 事件同步,微服务解耦
- Outbox 模式: 可靠事件发布
- 幂等性: ProcessedEvent 防重复处理

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 02:29:11 -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 2ed1658c16 fix(admin-service): exclude /downloads from API prefix
Downloads route was getting /api/v1 prefix, making it inaccessible at /downloads

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 07:44:53 -08:00
hailin eceb927d54 fix(admin-service): relax changelog and minOsVersion validation
- Changelog: allow empty value, return default "No changelog provided"
- MinOsVersion: allow empty value and single number format (e.g., "24" -> "24.0")

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 07:09:03 -08:00
hailin 58a359d9b3 fix: changelog default value and referrals map syntax
- admin-service: provide default empty string for optional changelog
- profile page: fix map literal syntax for referrals list

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 07:00:02 -08:00
hailin 586dfda8f7 fix(admin): support 4-segment version in domain layer & make changelog optional
- VersionName value object now accepts x.y.z.w format
- changelog field is now optional in upload version DTO
- profile page: ensure expired section has full width

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 06:54:55 -08:00
hailin 4307d1eb91 fix(admin): support 4-segment version number format (x.y.z.w)
Allow version names like 1.0.0.4 in addition to the standard x.y.z format.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 06:41:46 -08:00
hailin 747e4ae8ef refactor(mpc-system): migrate to party-driven architecture with PartyID-based routing
- Remove Address field from PartyEndpoint (parties connect to router themselves)
- Update K8s Discovery to only manage PartyID and Role labels
- Add Party registration and SessionEvent protobuf definitions
- Implement PartyRegistry and SessionEventBroadcaster domain logic
- Add RegisterParty and SubscribeSessionEvents gRPC handlers
- Prepare infrastructure for party-driven MPC coordination

This is the first phase of migrating from coordinator-driven to party-driven
architecture following international MPC system design patterns.
2025-12-05 08:11:28 -08:00
Developer 114a9e611c fix(admin-service): 修复 APK 解析 - 使用临时文件代替 Buffer
adbkit-apkreader 库只支持文件路径,不支持 Buffer
现在先将 Buffer 写入临时文件,解析后删除

参考: https://github.com/openstf/adbkit-apkreader

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 08:22:14 -08:00
Developer b1bee7f44e fix(admin-service): 修复 adbkit-apkreader 模块导入问题
使用 require() 代替 ES Module 导入,解决 'Cannot read properties of undefined' 错误

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 08:19:39 -08:00
Developer f8607ce0b2 feat: 增强移动端版本管理功能
## admin-service
- 添加 APK/IPA 预解析 API (/api/v1/versions/parse)
- 添加断点续传下载控制器 (/api/v1/downloads/:filename)
- 配置 uploads volume 持久化存储
- 下载 URL 从 /uploads 改为 /downloads (支持 Range 请求)

## mobile-upgrade (前端)
- 上传文件后自动解析并填充版本信息
- 添加 ParsedPackageInfo 类型和 parsePackage API

## mobile-app (Flutter)
- DownloadManager 支持断点续传 (HTTP Range)
- 添加临时文件管理和清理功能
- 添加构建脚本自动增加版本号 (scripts/build.sh)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 06:57:26 -08:00
Developer d55a2673dc fix(admin-service): 修复 APK 解析模块的 TypeScript 编译错误
- 修改 adbkit-apkreader 的 import 语法为 default export
- 更新类型声明文件支持 default export 模式

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:52:18 -08:00
Developer f9deca5df0 feat(admin-service): 增强移动端版本上传功能
- 添加 APK/IPA 文件解析器自动提取版本信息
- 支持从安装包自动读取 versionName 和 versionCode
- 添加 adbkit-apkreader 依赖解析 APK 文件
- 添加 plist 依赖解析 IPA 文件
- 优化上传接口支持自动填充版本信息

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-03 02:39:36 -08:00
Developer 6f55dc3195 fix(admin-service): 排除移动端API路由的全局前缀
移动端APP需要访问 /api/app/version/check,而不是 /api/v1/api/app/version/check
使用 setGlobalPrefix 的 exclude 选项排除移动端路由

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:50:04 -08:00
Developer 8a57013596 feat(admin-service): 实现完整的移动端版本管理和升级服务
- 添加版本CRUD API:list, get, update, delete, toggle
- 添加文件上传支持:APK/IPA文件上传并计算SHA256校验
- 新增移动端专用API endpoint: /api/app/version/check
- 修复deploy.sh自调用权限问题(使用绝对路径)
- 添加完整的技术文档 APP_UPGRADE_SERVICE.md

新增文件:
- MobileVersionController: 移动端兼容的版本检查接口
- FileStorageService: 文件上传和存储服务
- CQRS handlers: ListVersions, GetVersion, UpdateVersion, DeleteVersion, ToggleVersion, UploadVersion

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:31:36 -08:00
Developer 37c255bdc1 fix(admin-service): 修复TypeScript编译错误
- 修复 version.controller.ts 中 FileSize 使用 .bytes 替代 .value
- 修复测试文件中 AppVersion.create 缺少 isForceUpdate 参数
- 修复测试文件中使用正确的 Prisma Platform 枚举类型
- 修复 CreateVersionCommand 参数顺序错误

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 20:01:08 -08:00
Developer 3385997b86 refactor(admin-service): 完全按DDD架构重构,添加值对象层
值对象层 (Value Objects):
- VersionCode: 整数版本号,支持比较操作
- VersionName: 语义化版本格式 (major.minor.patch)
- BuildNumber: 构建号验证 (字母数字+点/下划线/连字符)
- DownloadUrl: HTTP/HTTPS URL 格式验证
- FileSha256: 64字符十六进制字符串验证
- FileSize: BigInt类型,2GB上限,支持人类可读格式转换
- Changelog: 更新日志 (10-5000字符)
- MinOsVersion: 最低操作系统版本格式验证

领域层重构:
- AppVersion Entity: 从贫血模型重构为充血模型
  - 私有字段 + getter 封装
  - 业务方法: disable(), enable(), setForceUpdate(), setReleaseDate()
  - 工厂方法: create() (新建), reconstitute() (重建)
  - 使用值对象替代所有原始类型

基础设施层:
- AppVersionMapper: 领域对象与持久化模型转换
- AppVersionRepositoryImpl: 使用 Mapper 进行数据转换
- 更新方法签名使用值对象类型

应用层:
- CreateVersionHandler: 创建值对象后构建领域实体
- CheckUpdateHandler: 从值对象提取值用于响应

共享层:
- DomainException: 领域异常基类

架构改进:
- 完整的 DDD 分层架构
- 值对象封装验证逻辑和业务规则
- 领域实体包含业务行为
- 清晰的领域-持久化边界

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 17:33:32 -08:00
Developer c45ed8a575 feat(admin-service): 实现移动应用版本管理服务
- DDD+Hexagonal架构
- Domain层: AppVersion实体, Platform枚举, Repository接口
- Infrastructure层: Prisma集成, Repository实现
- Application层: CheckUpdate查询(供移动端), CreateVersion命令(管理员)
- API层: VersionController, DTOs (request/response)
- 数据库: app_versions表设计(支持Android/iOS)
- 功能: 版本检查、强制更新、文件SHA-256校验
- 部署: Dockerfile, docker-compose.yml, deploy.sh脚本
- 数据库迁移: Prisma migration初始化

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 11:22:30 -08:00