hailin
9adef67bb8
feat(admin-web): P2P划转记录管理页面 + 手续费汇总
...
## 后端 — mining-admin-service
- users.controller: 新增 GET /users/p2p-transfers 端点(搜索+分页)
- 放在 :accountSequence 路由之前避免被 catch-all 拦截
- users.service: 新增 getP2pTransfers() 代理方法
- 调用 trading-service 的 /api/v2/p2p/internal/all-transfers
- 返回划转记录列表 + 汇总统计 + 分页信息
## 前端 — mining-admin-web
- 新增 /p2p-transfers 页面:
- 三个汇总卡片:累计手续费收入、累计划转金额、成功划转笔数
- 搜索框支持账号、手机号、转账单号搜索
- 记录表格:转账单号、发送方、接收方、转账金额、手续费、备注、时间
- 分页控件
- sidebar: 新增"P2P划转"导航项(位于"交易管理"下方)
- users.api: 新增 getP2pTransfers API + P2pTransferRecord 类型
- use-users: 新增 useP2pTransfers hook
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 10:41:55 -08:00
hailin
ca4e5393be
feat(p2p-transfer): 实现P2P划转手续费功能(全栈)
...
## 功能概述
- P2P转账(积分值)支持手续费收取,手续费存入系统成本费账户 S0000000002
- 发送方实际扣除 = 转账金额 + 手续费,接收方全额收到转账金额
- 手续费金额和最小划转金额可在管理后台动态配置(默认: 手续费5, 最小划转6)
## 后端 — mining-admin-service
- GET /configs/p2p-transfer-fee: 管理端获取手续费配置(需鉴权)
- POST /configs/p2p-transfer-fee: 管理端设置手续费配置,校验最小划转 > 手续费
- GET /configs/internal/p2p-transfer-fee: 内部调用端点(@Public 无鉴权)
## 后端 — trading-service
- Prisma schema: P2pTransfer model 新增 fee Decimal(30,8) 字段
- docker-compose: 新增 MINING_ADMIN_SERVICE_URL 环境变量
- p2p-transfer.service: 动态获取手续费配置,余额校验含手续费,
事务内分别记录转账流水和手续费流水(P2P_TRANSFER_FEE),
手续费存入系统成本费账户 S0000000002
- p2p-transfer.controller: 新增 GET /p2p/transfer-fee-config 代理端点
- 转账结果和历史记录新增 fee 字段返回
## 前端 — mining-admin-web
- configs.api.ts: 新增 getP2pTransferFee / setP2pTransferFee API
- use-configs.ts: 新增 useP2pTransferFee / useSetP2pTransferFee hooks
- configs/page.tsx: 新增"P2P划转手续费设置"卡片(手续费 + 最小划转金额)
## 前端 — mining-app (Flutter)
- api_endpoints.dart: 新增 p2pTransferFeeConfig 端点常量
- p2p_transfer_fee_config_model.dart: 新增手续费配置 Model
- trading_remote_datasource.dart: 新增 getP2pTransferFeeConfig 方法
- transfer_providers.dart: 新增 p2pTransferFeeConfigProvider
- send_shares_page.dart: 发送页面显示手续费信息、最小划转金额提示、
实际扣除金额计算、"全部"按钮扣除手续费、确认弹窗展示手续费明细
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 06:44:19 -08:00
hailin
40389fcfc7
feat(trading-service, mining-admin-web): 支持在管理后台配置做市商钱包地址
...
- 后端: 在 UpdateConfigDto 和 updateConfig 方法中添加 kavaWalletAddress 字段
- 前端: 在充值对话框中添加钱包地址配置输入框
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 07:53:04 -08:00
hailin
58feec255d
feat(market-maker): 实现做市商区块链充提功能
...
- 扩展 mining-blockchain-service 支持 eUSDT/fUSDT 转账
- 添加 trading-service 区块链提现 API(自动回滚失败交易)
- 前端支持中心化和区块链充提两种模式(Tab切换)
- 区块链充值显示钱包地址和二维码
- 区块链提现支持输入目标地址直接转账
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 17:56:15 -08:00
hailin
e9dea69ee9
feat(batch-mining): 动态获取批量补发计算起始日期
...
重构批量补发功能,将硬编码的起始日期(2025-11-08)改为从 Excel 数据中
动态获取,提高计算的准确性和灵活性。
后端改动 (mining-service):
- 新增 DEFAULT_MINING_START_DATE 常量作为找不到有效数据时的默认值
- 新增 getCalculatedStartDate() 方法:从批次1用户的 miningStartDate 中
获取最早日期
- 新增 parseDate() 方法:支持解析 2025.11.8、2025-11-08、2025/11/8 格式
- 修改 buildMiningPhases() 方法:新增 startDateStr 参数,不再硬编码日期
- 修改 preview/execute 方法:在返回结果中包含 calculatedStartDate 字段
前端改动 (mining-admin-web):
- 更新 BatchPreviewResult 接口,新增 calculatedStartDate 字段
- 预览结果描述中显示计算起始日期(蓝色高亮)
- 确认对话框中新增"计算起始日期"行
降级策略:
- 若批次1用户不存在或日期均无效,自动使用默认日期 2025-11-08
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 02:01:40 -08:00
hailin
8a47659c47
feat(batch-mining): 按阶段创建补发记录并添加用户查询功能
...
- 修改BatchMiningRecord表结构,添加phase和daysInPhase字段
- 修改execute函数,按阶段为每个用户创建记录
- 添加用户批量补发记录查询API
- mining-admin-web用户详情页添加"批量补发"Tab
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-22 00:30:06 -08:00
hailin
8f0fc09a4c
fix(mining-admin-web): 解包 mining-admin-service 响应的 TransformInterceptor 包装
...
mining-admin-service 也使用 TransformInterceptor 将所有响应包装为 { success, data, timestamp } 结构,
前端需要从 res.data.data 中提取实际数据。
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 06:34:36 -08:00
hailin
7a4f5591b7
feat(batch-mining): 添加详细的调试日志
...
- mining-service batch-mining.service.ts: 添加所有方法的详细日志
- mining-admin-service batch-mining.service.ts: 添加 HTTP 请求和响应日志
- mining-admin-service batch-mining.controller.ts: 添加控制器层日志
- frontend batch-mining page.tsx: 添加前端 console.log 日志
便于调试部署后的 404 等问题
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 05:49:04 -08:00
hailin
cb9831f2fc
feat(mining-admin-web): 前端实现区域代码到中文名称转换
...
系统账户列表现在显示中文省市名称(如"广州市公司")而不是区域代码(如"440100账户")
- 新增 region-codes.ts 包含完整的省市行政区划代码映射
- 修改 accounts-table.tsx 使用 getRegionDisplayName() 转换名称
- 修改 account-card.tsx 使用区域代码映射
- 修改账户详情页使用区域代码映射显示标题
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 05:20:50 -08:00
hailin
71151eaabf
feat(mining): 添加批量补发挖矿功能
...
- 新增批量补发服务和API (mining-service)
- 支持按批次累积计算全网算力
- 用户算力 = 认种棵数 × 22617 × 70%
- 补发金额 = (用户算力/全网算力) × 每秒分配量 × 天数 × 86400
- 防重复执行机制(只能执行一次)
- 新增文件上传和批量补发API (mining-admin-service)
- 支持上传 Excel 文件解析
- 预览和执行两步操作
- 审计日志记录
- 新增批量补发页面 (mining-admin-web)
- Excel 文件上传
- 按批次预览计算结果
- 执行确认对话框
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 04:59:13 -08:00
hailin
97e974b6da
fix(frontend): 添加 regionCode 参数到算力来源 API 调用
2026-01-21 02:13:41 -08:00
hailin
09b0bc077e
feat(system-accounts): 实现系统账户按省市细分算力和挖矿分配
...
## 核心功能
### 1. 算力按省市细分分配
- accountType 从枚举改为组合键字符串:PROVINCE_440000, CITY_440100
- 新增 baseType (基础类型) 和 regionCode (区域代码) 字段
- 认种时根据 selectedProvince/selectedCity 分配到具体省市账户
- 无省市信息时归入汇总账户
### 2. 系统账户参与挖矿
- 运营、省、市账户按各自 totalContribution 参与挖矿
- 总部账户(HEADQUARTERS)不直接参与,接收待解锁算力收益
- 待解锁算力 100% 参与挖矿,收益归总部
### 3. 算力来源明细追溯
- 新增 SystemContributionRecord 记录每笔算力来源
- 新增 SystemContributionRecordCreatedEvent 事件同步明细
- 前端新增"算力来源"标签页展示明细
## 修改的服务
### contribution-service
- schema: SystemAccount 新增 baseType, regionCode
- contribution-calculator: 按省市生成组合键
- system-account.repository: 支持动态创建省市账户
- 新增 SystemContributionRecordCreatedEvent 事件
### mining-service
- schema: SystemMiningAccount 从枚举改为字符串
- network-sync: 处理带 baseType/regionCode 的同步事件
- mining-distribution: 系统账户和待解锁算力参与挖矿
### mining-admin-service
- schema: 新增 SyncedSystemContributionRecord 表
- cdc-sync: 处理 SystemContributionRecordCreated 事件
- system-accounts.service: 新增算力来源明细和统计 API
### mining-admin-web
- 新增 ContributionRecordsTable 组件
- 系统账户详情页新增"算力来源"标签页
- 显示来源认种ID、用户、分配比例、金额
## 数据库迁移
- contribution-service: 20250120000001_add_region_to_system_accounts
- mining-service: 20250120000001_add_region_to_system_mining_accounts
- mining-admin-service: 20250120000001, 20250120000002
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 19:55:14 -08:00
hailin
63c192e90d
feat(pending-contributions): 添加待解锁算力分类账功能
...
功能说明:
- 待解锁算力是因用户未满足解锁条件(如直推数不足)而暂存的层级/奖励算力
- 这部分算力参与挖矿,但收益归入总部账户(HEADQUARTERS)
后端变更:
- mining-service: 添加4个待解锁算力相关API
- GET /admin/pending-contributions - 获取待解锁算力列表(支持分页和类型筛选)
- GET /admin/pending-contributions/summary - 获取汇总统计(按类型统计、总挖矿收益)
- GET /admin/pending-contributions/:id/records - 获取单条记录的挖矿明细
- GET /admin/pending-contributions/mining-records - 获取所有挖矿记录汇总视图
- mining-admin-service: 添加代理层
- 新建 PendingContributionsService 调用 mining-service API
- 新建 PendingContributionsController 暴露 API 给前端
前端变更:
- 新建 pending-contributions feature 模块(API、hooks、类型定义)
- 新建 /pending-contributions 页面
- 汇总统计卡片(总量、已归入总部积分股、挖矿记录数)
- 按类型统计展示
- 算力列表Tab(来源用户、归属用户、类型、算力、原因、创建时间)
- 挖矿记录Tab(时间、类型、算力、占比、每秒分配量、挖得数量、归入)
- 在仪表盘的层级算力和团队奖励卡片添加"查看分类账"链接
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:13:22 -08:00
hailin
d957e5a841
feat(admin): 系统账户添加已挖积分股显示和分类账功能
...
## 后端改动
### mining-service
- 新增 GET /admin/system-accounts/:accountType/records - 获取系统账户挖矿记录(分钟级)
- 新增 GET /admin/system-accounts/:accountType/transactions - 获取系统账户交易记录
### mining-admin-service
- 添加 @nestjs/axios 依赖用于 HTTP 调用
- 修改 SystemAccountsService,通过 HTTP 调用 mining-service 获取挖矿数据(totalMined, availableBalance)
- 新增挖矿记录和交易记录的代理 API
## 前端改动
### 类型定义
- SystemAccount 新增 totalMined, availableBalance, miningContribution, miningLastSyncedAt 字段
### API 层
- 新增 getMiningRecords 和 getTransactions API 方法
- 新增 SystemMiningRecord, SystemTransaction 等类型定义
### Hooks
- 新增 useSystemAccountMiningRecords 和 useSystemAccountTransactions
### 组件
- AccountsTable 新增"已挖积分股"列,显示每个系统账户累计挖到的积分股
- AccountsTable 新增"分类账"按钮,可跳转到账户详情页
### 新页面
- 新建 /system-accounts/[accountType] 详情页面
- 账户概览卡片:当前算力、已挖积分股、可用余额、挖矿记录数
- 挖矿记录 Tab:分钟级挖矿明细(时间、算力占比、全网算力、每秒分配量、挖得数量)
- 交易记录 Tab:所有交易流水(时间、类型、金额、交易前后余额、备注)
- 支持分页浏览
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 05:53:03 -08:00
hailin
7bc911d4d7
feat(mining): 实现手工补发挖矿功能
...
为从1.0系统同步的用户提供手工补发历史挖矿收益功能:
- mining-service: 添加 ManualMiningRecord 表和计算/执行补发逻辑
- mining-wallet-service: 添加 MANUAL_MINING_REWARD 交易类型和 Kafka 消费者
- mining-admin-service: 添加补发 API 控制器和代理服务
- mining-admin-web: 添加手工补发页面和侧边栏菜单项
功能特点:
- 根据用户算力和当前挖矿配置计算补发金额
- 每个用户只能执行一次补发操作
- 通过 Kafka 事件确保跨服务数据一致性
- 完整的操作记录和钱包同步状态追踪
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 03:50:03 -08:00
hailin
8c78f26e6d
feat(trading): 实现做市商吃单/挂单模式互斥机制
...
## 后端 - trading-service
### MarketMakerService
- 新增 MarketMakerMode 类型:'idle' | 'taker' | 'maker'
- 新增 getCurrentMode() 和 getRunningStatus() 方法获取当前运行状态
- start() (吃单模式): 启动前自动停止挂单模式
- startMaker() (挂单模式): 启动前自动停止吃单模式
- 两种模式互斥,同一时间只能运行一种
### MarketMakerController
- getConfig 接口返回 runningStatus 运行状态
- 新增 GET /status 接口获取做市商运行状态
## 前端 - mining-admin-web
### 做市商管理页面
- 新增运行模式状态卡片,显示当前模式(空闲/吃单/挂单)
- 吃单模式和挂单模式使用 runningStatus 判断状态
- 添加互斥提示:启动一个模式会自动停止另一个
- 挂单模式添加警告提示:卖单被吃会触发销毁导致价格上涨
### API 更新
- 新增 RunningStatus 接口类型
- getConfig 返回类型增加 runningStatus
- 新增 getRunningStatus API
## 设计说明
- 吃单模式(推荐):做市商只作为买方,不触发额外销毁
- 挂单模式(谨慎使用):做市商挂卖单会触发销毁机制
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:41:39 -08:00
hailin
3b6bd29283
feat(trading): 实现完整的CEX做市商双边深度系统
...
## 后端 - trading-service
### 数据库模型扩展 (Prisma Schema)
- TradingConfig: 新增 depthEnabled 字段控制深度显示开关
- MarketMakerConfig: 新增双边挂单配置
- makerEnabled: 做市商挂单模式开关
- bidEnabled/askEnabled: 买/卖方向独立开关
- bidLevels/askLevels: 买/卖档位数量
- bidSpread/askSpread: 买/卖价差比例
- bidLevelSpacing/askLevelSpacing: 档位间距
- bidQuantityPerLevel/askQuantityPerLevel: 每档数量
- refreshIntervalMs: 刷新间隔
- MarketMakerOrder: 新增做市商订单追踪模型
- MarketMakerLedger: 新增做市商账户流水模型
### 做市商服务 (MarketMakerService)
- depositShares/withdrawShares: 积分股充值/提现
- startMaker/stopMaker: 做市商挂单模式启停
- refreshMakerOrders: 核心双边挂单逻辑
- 根据当前价格计算买卖各档位价格和数量
- 自动撤销旧订单并创建新订单
- 记录做市商订单关联
- cancelAllMakerOrders: 撤销所有做市商订单
- getDepth: 获取订单簿深度数据
- updateMakerConfig/getMakerOrders: 配置和订单查询
### API 端点
- MarketMakerController:
- POST /deposit-shares: 积分股充值
- POST /withdraw-shares: 积分股提现
- POST /start-maker: 启动挂单模式
- POST /stop-maker: 停止挂单模式
- POST /refresh-orders: 手动刷新订单
- POST /cancel-all-orders: 撤销所有订单
- PUT /maker-config: 更新挂单配置
- GET /maker-orders: 查询做市商订单
- GET /depth: 获取深度数据
- AdminController:
- GET/POST /trading/depth-enabled: 深度显示开关
- PriceController:
- GET /depth: 公开深度接口 (受 depthEnabled 控制)
### 领域层扩展
- TradingAccountAggregate: 新增 depositShares/withdrawShares 方法
- OrderAggregate: 支持 source 字段标识订单来源
## 前端 - mining-admin-web
### 做市商管理页面 (/market-maker)
- 账户余额展示: 积分值和积分股余额
- 资金管理: 积分值/积分股的充值和提现对话框
- 吃单模式: 启动/停止/手动吃单控制
- 挂单模式: 启动/停止/刷新订单/撤销所有
- 深度开关: 控制公开 API 是否返回深度数据
- 深度展示: 实时显示买卖盘深度数据表格
### 前端架构
- market-maker.api.ts: 完整的 API 客户端
- use-market-maker.ts: React Query hooks 封装
- sidebar.tsx: 新增"做市商管理"导航菜单
## 数据库迁移
- 0003_add_market_maker_depth: 双边深度相关字段
- 0005_add_market_maker_and_order_source: 订单来源追踪
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 21:11:23 -08:00
hailin
481a355d72
feat(trading): add buy function control switch with admin management
...
- Add buyEnabled field to TradingConfig in trading-service with migration
- Add API endpoints for get/set buy enabled status in admin controller
- Add buy function switch card in mining-admin-web trading page
- Implement buyEnabledProvider in mining-app with 2-minute cache
- Show "待开启" when buy function is disabled in trading page
- Add real-time asset value refresh in asset page (1-second updates)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:56:35 -08:00
hailin
e80e672ffe
feat(mining-admin): add mining progress dashboard component
...
Add real-time mining progress statistics similar to burn progress:
- Backend: new /admin/mining/status endpoint in mining-service
- Frontend: MiningProgress component with progress bar and stats
- Shows: total distributed, remaining pool, minutes left, per-minute rate
- Auto-refresh every 60 seconds via React Query
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:00:20 -08:00
hailin
2534068f70
fix(mining): remove duplicate burn mechanism from mining-service
...
Mining-service incorrectly implemented its own burn mechanism (10-year
cycle) which was not in the requirements. Per requirements, only
trading-service should handle per-minute burn (4756.47/minute).
Removed:
- BlackHoleRepository and all burn-related methods
- executeBurn() from mining distribution service
- Burn stats from admin API and queries
- Burn progress UI from mining admin web
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:31:13 -08:00
hailin
9e15fa4fd8
fix(admin-web): 修复全网算力同步状态显示
...
- 将显示内容从用户有效算力改为全网理论算力
- 显示 mining-service 和 contribution-service 的全网理论算力对比
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 04:02:29 -08:00
hailin
7c00c900a0
feat(mining-admin): 算力同步完成前禁用激活挖矿按钮
...
- 后端:getMiningStatus 接口并行获取 contribution-service 总算力,对比两边是否一致
- 前端:未同步时显示"全网算力同步中..."提示,禁用激活按钮
- 前端:同步中每 3 秒刷新状态,同步完成后恢复 30 秒刷新
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 03:00:40 -08:00
hailin
8018fa5110
feat(admin): add trading system management UI and API
...
- Add trading system activate/deactivate endpoints to trading-service
- Add trading management page to mining-admin-web with:
- Trading system status display and control
- Market overview (price, green points, circulation pool)
- Burn progress visualization
- Burn records list with filtering
- Add trading-service proxy configuration to next.config.js
- Add trading menu item to sidebar navigation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 20:37:52 -08:00
hailin
1bdb9bb336
style(mining-admin-web): display all numbers with 8 decimal places
...
Update all formatDecimal, formatNumber, formatPercent, formatCompactNumber
and formatShareAmount calls to use 8 decimal precision for consistent display
across all pages (dashboard, users, reports, system-accounts).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 02:55:23 -08:00
hailin
cfbf1b21f3
feat(dashboard): add detailed contribution breakdown by category
...
Backend (contribution-service):
- Add getDetailedContributionStats() to repository
- Add getUnallocatedByLevelTier/BonusTier() to repository
- Extend stats API with level/bonus breakdown by tier
- Add getTotalTrees() to synced-data repository
Backend (mining-admin-service):
- Add detailed contribution stats calculation
- Calculate theoretical vs actual values per category
- Return level/bonus breakdown with unlocked/pending amounts
Frontend (mining-admin-web):
- Add ContributionBreakdown component showing:
- Personal (70%), Operation (12%), Province (1%), City (2%)
- Level contribution (7.5%) by tier: 1-5, 6-10, 11-15
- Bonus contribution (7.5%) by tier: T1, T2, T3
- Update DashboardStats type definition
- Integrate breakdown component into dashboard page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 01:43:37 -08:00
hailin
3b61f2e095
feat(mining): 实现每秒挖矿分配系统
...
核心改动:
- 调度器从每分钟改为每秒执行,用户每秒看到挖矿收益
- 每秒更新账户余额,但MiningRecord每分钟汇总写入一次(减少数据量)
- seed自动执行(prisma.seed配置),初始化后isActive=false
- 只有一个手动操作:管理员在后台点击"启动挖矿"
技术细节:
- 每秒分配量:100万/63,072,000秒 ≈ 0.01585 shares/秒
- Redis累积器:每秒挖矿数据累积到Redis,每分钟末写入数据库
- 分布式锁:0.9秒锁定时间,支持多实例部署
- 后台管理界面:添加挖矿状态卡片和激活/停用按钮
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 03:25:47 -08:00
hailin
bd0f98cfb3
fix(mining-admin-web): fix audit logs page crash
...
- Use 'all' instead of empty string for SelectItem value (Radix requirement)
- Add null safety for items array with fallback to empty array
- Fix potential undefined access on data.items
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 02:30:07 -08:00
hailin
d6064294d7
refactor(mining-admin): remove initialization feature
...
System initialization is now handled by seed scripts and CDC sync,
so the manual initialization UI is no longer needed.
Removed:
- Frontend: initialization page and sidebar menu item
- Backend: InitializationController and InitializationService
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 02:22:23 -08:00
hailin
d43a70de93
feat(mining-admin): implement complete system accounts feature
...
- Add system account types and display metadata
- Create API layer with getList and getSummary endpoints
- Add React Query hooks for data fetching
- Create AccountCard, AccountsTable, SummaryCards components
- Refactor page with tabs, refresh button, and error handling
- Add Alert UI component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 20:27:59 -08:00
hailin
65bd4f9b65
fix(mining-admin): remove MINING_ENABLED status filter for adoption stats
...
The adoption stats were showing 0 because the synced_adoptions table
contains status values directly from 1.0 system (PAID, POOL_INJECTED, etc.)
rather than MINING_ENABLED. Since contribution-service doesn't update the
status after calculating contributions, we now count all synced adoptions.
Changes:
- Remove status filter in getAdoptionStatsForUsers
- Remove status filter in getUserDetail adoption queries
- Remove status filter in getUserAdoptionStats for referral tree
- Add order count display in user detail page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 01:21:01 -08:00
hailin
2f3a0f3652
feat(mining-admin): display adoption order count in user management
...
Backend:
- Add personalOrders and teamOrders to adoption stats
- Return order count alongside tree count in user list API
Frontend:
- Add personalAdoptionOrders and teamAdoptionOrders to UserOverview type
- Display format: "树数量(订单数)" e.g. "6(3单)"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 01:03:59 -08:00
hailin
1d7d38a82c
fix(frontend): prevent redirect to dashboard on page refresh
...
Fix hydration race condition where token check happened before
localStorage was read. Now waits for client-side initialization
before deciding whether to redirect to login.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 00:25:59 -08:00
hailin
180e5ad057
feat(mining-admin): 重构算力构成展示,添加解锁状态
...
- 后端添加 unlockedBonusTiers 字段同步
- 前端算力构成卡片展示层级解锁(L1-15)和团队奖励解锁(3档)状态
- 移除无用的系统运营/省级/市级字段
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 04:59:51 -08:00
hailin
fc3efe6a27
fix(mining-admin-web): 修复 React hydration 错误 #418 #423
...
- 修改 Zustand sidebar store 使用 skipHydration 避免 SSR 不匹配
- 移除 Redux auth slice 初始状态中的 localStorage 读取
- 在 providers 中使用 useEffect 初始化客户端状态
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 20:47:00 -08:00
hailin
3fe4f82906
fix(mining-admin-web): 修复用户列表页面空数据和错误处理
...
- 修复 data.items 可能为 undefined 导致的崩溃
- 添加 API 错误状态显示
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 19:06:26 -08:00
hailin
2a22d7d669
fix(mining-admin-web): 修复用户列表页面类型错误
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 19:01:37 -08:00
hailin
8fc527b918
feat(mining-admin-web): 复用admin-web用户管理功能
...
- 更新用户列表:添加头像、个人/团队认种、推荐人、状态徽章
- 更新用户详情:添加头像、KYC状态、认种统计卡片
- 新增引荐关系Tab:展示引荐人链和直推下级树
- 新增认种信息Tab:认种汇总和认种分类账明细
- 新增钱包信息Tab:钱包汇总和钱包分类账明细
- 更新类型定义和API hooks
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:58:48 -08:00
hailin
a17f408653
feat(mining-ecosystem): 添加挖矿生态系统完整微服务与前端
...
## 概述
为榴莲生态2.0添加完整的挖矿系统,包含3个后端微服务、1个管理后台和1个用户端App。
---
## 后端微服务
### 1. mining-service (挖矿服务) - Port 3021
**核心功能:**
- 积分股每日分配(基于算力快照)
- 每分钟定时销毁(进入黑洞)
- 价格计算:价格 = 积分股池 ÷ (100.02亿 - 黑洞 - 流通池)
- 全局状态管理(黑洞量、流通池、价格)
**关键文件:**
- src/application/services/mining-distribution.service.ts - 挖矿分配核心逻辑
- src/application/schedulers/mining.scheduler.ts - 定时任务调度
- src/domain/services/mining-calculator.service.ts - 分配计算
- src/infrastructure/persistence/repositories/black-hole.repository.ts - 黑洞管理
### 2. trading-service (交易服务) - Port 3022
**核心功能:**
- 积分股买卖撮合
- K线数据生成
- 手续费处理(10%买入/卖出)
- 流通池管理
- 卖出倍数计算:倍数 = (100亿 - 销毁量) ÷ (200万 - 流通池量)
**关键文件:**
- src/domain/services/matching-engine.service.ts - 撮合引擎
- src/application/services/order.service.ts - 订单处理
- src/application/services/transfer.service.ts - 划转服务
- src/domain/aggregates/order.aggregate.ts - 订单聚合根
### 3. mining-admin-service (挖矿管理服务) - Port 3023
**核心功能:**
- 系统配置管理(分配参数、手续费率等)
- 老用户数据初始化
- 系统监控仪表盘
- 审计日志
**关键文件:**
- src/application/services/config.service.ts - 配置管理
- src/application/services/initialization.service.ts - 数据初始化
- src/application/services/dashboard.service.ts - 仪表盘数据
---
## 前端应用
### 1. mining-admin-web (管理后台) - Next.js 14
**技术栈:**
- Next.js 14 + React 18
- TailwindCSS + Radix UI
- React Query + Zustand
- ECharts 图表
**功能模块:**
- 登录认证
- 仪表盘(实时数据、价格走势)
- 用户查询(算力详情、挖矿记录、交易订单)
- 系统配置管理
- 数据初始化任务
- 审计日志查看
### 2. mining-app (用户端App) - Flutter 3.x
**技术栈:**
- Flutter 3.x + Dart
- Riverpod 状态管理
- GoRouter 路由
- Clean Architecture (3层)
**功能模块:**
- 首页资产总览
- 实时收益显示(每秒更新)
- 贡献值展示(个人/团队)
- 积分股买卖交易
- K线图与价格显示
- 个人中心
---
## 架构文档
- docs/mining-ecosystem-architecture.md - 系统架构总览
- 服务职责与端口分配
- 数据流向图
- Kafka Topics 定义
- 跨服务关联(account_sequence)
- 配置参数说明
- 开发顺序建议
---
## .gitignore 更新
- 添加 Flutter/Dart 构建文件忽略
- 添加 iOS/Android 构建产物忽略
- 添加 Next.js 构建目录忽略
- 添加 TypeScript 缓存文件忽略
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:45:46 -08:00