Commit Graph

76 Commits

Author SHA1 Message Date
hailin 2154d5752f fix: 修复K线图NaN错误并添加mining-service划转端点
- 修复K线图当价格范围为0时导致的NaN Offset错误
- 在mining-service添加transfer-out和transfer-in端点
- 划转操作会在mining_transactions表中记录明细

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 07:12:32 -08:00
hailin 4e181354f4 feat(frontend): 添加积分股划转功能
- 交易页面添加划转入口链接
- 实现双向划转弹窗(划入交易账户/划出到挖矿账户)
- 新增划转历史记录页面
- 添加划转相关 API 调用

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 06:57:23 -08:00
hailin 4bb5a2b09d refactor(frontend): 资产页面显示实际积分股和价格,移除倍数
- 资产显示值改为 积分股余额 × price(不含倍数)
- 显示实际积分股数量而非含倍数的有效积分股
- 简化实时计算逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 04:28:30 -08:00
hailin 4a4393f995 fix(frontend): 修复资产页面实时增长计算漏乘burnMultiplier
资产每秒增长公式应为: 每秒积分股增长 × (1 + burnMultiplier) × price
之前漏掉了 (1 + burnMultiplier) 因子,导致增长被低估约5000倍

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-18 03:42:21 -08:00
hailin b826511f3c chore(frontend): 移除资产页面调试日志
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 23:16:15 -08:00
hailin 4f1f1f9eaf feat(mining): 添加 perSecondEarning 到挖矿账户 API
- 后端:计算每秒收益 = (用户贡献 / 全网贡献) × 每秒分配量
- 前端:修正字段映射以匹配后端返回格式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:56:19 -08:00
hailin 33233901a9 debug(frontend): 添加资产页面定时器调试日志
添加 debugPrint 日志帮助定位1秒刷新不生效的问题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:49:46 -08:00
hailin d8dd38e91b fix(frontend): 修复资产页面1秒实时刷新问题
- 使用 mining-service 的 perSecondEarning 替代 assetGrowthPerSecond
- 添加 _timerStarted 标志防止定时器重复启动
- 修复页面进入时定时器可能未启动的问题
- 下拉刷新时同步刷新 shareAccountProvider
- 正确显示每秒增长值

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:42:23 -08:00
hailin 5c633b9979 perf(frontend): 优化交易页面数据刷新策略
- 价格刷新: 5分钟 → 15秒
- 订单刷新: 2分钟 → 10秒
- 市场概览: 5分钟 → 30秒
- 交易账户: 2分钟 → 15秒
- 交易成功后立即刷新 + 2秒后再刷新 + 5秒后最终刷新
- 确保用户能快速看到做市商吃单后的成交状态

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 22:14:52 -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 e8f3c34723 fix(contribution): 认种记录总贡献值显示用户实际有效算力
后端:
- get-planting-ledger.query.ts: 添加effectiveContribution字段
- 从contributionAccount获取用户实际的个人算力(personalContribution)

前端:
- planting_record.dart: PlantingSummary添加effectiveContribution字段
- planting_record_model.dart: 解析effectiveContribution字段
- planting_records_page.dart: 总贡献值显示effectiveContribution而非totalAmount

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:29:14 -08:00
hailin 613fb33ff9 refactor(frontend): 删除兑换页面卖出功能中的销毁比例标签
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 08:24:26 -08:00
hailin d5f3f3b868 feat(frontend): 实现我的页面其他设置4项功能
- 消息通知: 添加开关控制,状态持久化到SharedPreferences
- 深色模式: 添加开关控制,状态持久化到SharedPreferences
- 帮助中心: 新建页面,包含常见问题FAQ和联系方式
- 关于我们: 新建页面,包含应用简介、功能特点、联系方式和法律条款

新增文件:
- settings_providers.dart: 设置状态管理
- help_center_page.dart: 帮助中心页面
- about_page.dart: 关于我们页面

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 01:08:21 -08:00
hailin 1aaf32cbb3 refactor(frontend): 认种记录汇总中总金额改为总贡献值
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:33:57 -08:00
hailin d424f2a18e refactor: rename '算力占比' to '贡献值占比' in mining records
- Update label in Flutter mining records page
- Update table header in admin web mining records list
- Update memo strings in mining-wallet-service

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:33:02 -08:00
hailin 725fb80f80 refactor(frontend): 删除我的页面中的支付密码功能
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:28:30 -08:00
hailin 76d6c30a20 refactor(frontend): 发送/接收积分股改名为积分值
- send_shares_page.dart: 标题改为发送积分值,提示信息同步更新
- receive_shares_page.dart: 标题改为接收积分值

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:26:44 -08:00
hailin 216394a44f refactor(trading): rename 卖出相关 黑洞 to 积分股池
- Update 10% 进入黑洞 to 10% 进入积分股池
- Update 销毁金额 to 进入积分股池 in sell confirmation
- Update 注意 text in sell confirmation
- Change color from red to green for 积分股池 text

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 00:15:38 -08:00
hailin ea1e376939 chore(app): rename app to 股行
- Update Android app label in AndroidManifest.xml
- Update iOS CFBundleDisplayName and CFBundleName in Info.plist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 23:50:23 -08:00
hailin d5e5bf642c fix(kline-chart): prevent overflow in indicator selector and legend
- Wrap indicator selector Row in SingleChildScrollView for horizontal scrolling
- Add maxX boundary checks in _drawLegend to stop drawing when exceeding available space
- Prevents text overflow on narrow screens or when displaying many indicators

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 09:55:49 -08:00
hailin 27bf67e561 fix(kline-chart): improve pinch-to-zoom and fullscreen display
- Refactor to pixel-based scrolling system for smoother interaction
- Fix pinch-to-zoom to properly scale around focal point
- Adjust fullscreen layout to give more space to main chart (65%)
- Add candleWidth parameter to all painters for consistent rendering
- Detect multi-touch gestures using pointerCount

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 09:49:14 -08:00
hailin 1f0bd15946 feat(mining-app): add trading records page and remove withdrawal records
- Add TradingRecordsPage to display trade order history with status
- Connect trading records to profile page "交易记录" button
- Remove unused "提现记录" button from profile page
- Add route and navigation for trading records

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 09:22:15 -08:00
hailin 4ec6c9f48b feat(contribution/mining-app): add team tree API using contribution-service 2.0
Add team info and direct referrals endpoints to contribution-service,
using SyncedReferral data synced via CDC. Update mining-app to use the
new v2 contribution API instead of legacy referral-service.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 09:17:18 -08:00
hailin 3d6b6ae405 feat(mining-app): connect my team page from profile
Link the "我的团队" menu item in profile page to the team tree page,
completing the integration of the team tree feature.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 09:03:06 -08:00
hailin 64ccb8162a fix(admin): correct distributed shares calculation to use 2M pool
The dashboard was incorrectly using 5 billion as the distribution pool
default when calculating already distributed shares. The actual mining
distribution pool is 2 million shares, not 100 billion.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:59:46 -08:00
hailin 20a90fce4c feat(mining-app): add professional kline chart with technical indicators
- Add KlineChartWidget with pinch-to-zoom, fullscreen mode
- Implement MA, EMA, BOLL indicators for main chart
- Implement MACD, KDJ, RSI indicators for sub chart
- Add volume display with crossline info
- Add C2C trading feature with market/publish/detail pages
- Add P2P transfer functionality (send/receive shares)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 08:51:00 -08:00
hailin 3096297198 feat(mining-app): 资产页面优化及个人资料编辑功能
- 删除资产页面的"提现"按钮,将"划转"改为"C2C"
- 删除积分值卡片上的"可提现"标签
- 简化资产页面和兑换页面的标题栏,移除左右图标
- 统一资产页面背景色与兑换页面一致
- 新增个人资料编辑页面,支持头像颜色选择和昵称修改
- 头像和昵称支持本地存储

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:58:16 -08:00
hailin 854bb7a0ac fix(mining-admin): correct ContributionSyncStatus property names
Property names should match what's used in the UI component:
- miningNetworkTotal (was miningTotal)
- networkTotalContribution (was contributionTotal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-16 07:41:59 -08:00
hailin 72b3b44d37 feat(trading): 实现K线图真实数据展示与Y轴自适应
后端 (trading-service):
- 新增 GET /api/v2/price/klines API 端点
- 支持多周期K线聚合 (1m/5m/15m/30m/1h/4h/1d)
- 将 PriceSnapshot 数据聚合为 OHLC 格式

前端 (mining-app):
- 添加 klinesProvider 获取K线数据
- 重写 _CandlestickPainter 使用真实数据
- 实现 Y轴自适应显示,放大价格变化
- 周期选择器联动数据刷新

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 23:57:12 -08:00
hailin 1e2d8d1df7 feat(asset): aggregate mining and trading account balances in asset display
- Modify AssetService to fetch mining account balance from mining-service
- Sum mining balance + trading balance for total share display
- Add miningShareBalance and tradingShareBalance fields to AssetDisplay
- Update frontend entity and model to support new fields

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 19:53:31 -08:00
hailin ed715111ae fix(trading): auto-initialize SharePool and CirculationPool on startup
- Add SharePool and CirculationPool initialization in BurnService.initialize()
- Initialize SharePool with 5760 green points (fixes price showing as 0)
- Remove misleading "= 5,760 积分值" display from trading page

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 19:32:46 -08:00
hailin 4b1855f57a fix(mining-app): use public API for asset page to avoid JWT mismatch
Changed from myAssetProvider (requires JWT) to accountAssetProvider
(public API) to avoid 401 errors when trading-service JWT_SECRET
doesn't match auth-service.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 06:34:19 -08:00
hailin 40869ef00f feat: split share pool into A (100亿) and B (200万) accounts
Backend changes:
- mining-wallet-service: Split SHARE_POOL into SHARE_POOL_A (100亿, for burning)
  and SHARE_POOL_B (200万, for mining distribution)
- Add /pool-accounts/share-pool-balance API endpoint to get total balance
- Update pool initialization logic and seed data
- Fix Kong routing for mining-wallet-service (strip_path: true)
- Fix Kong routing for trading-service (strip_path: true)

Constant updates (100.02亿 = 10,002,000,000):
- mining-service: TOTAL_SHARES
- trading-service: TOTAL_SHARES, trading config defaults
- trading-service seed: initial green points = 5760

Frontend changes:
- Add sharePoolBalanceProvider to fetch pool balance from mining-wallet-service
- Update contribution page to display real-time share pool balance (A + B)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:55:52 -08:00
hailin d12bbb17be feat(mining-app): add share pool balance display on contribution page
Display real-time share pool balance (积分股池实时余量) in the total
contribution card on the contribution page.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 04:27:48 -08:00
hailin 183b2bef59 style(mining-app): hide accountSequence and rename phone to ID on profile page
- Remove accountSequence (ID: xxxx) display from profile page
- Rename "手机:" label to "ID:" for phone number display

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 03:39:18 -08:00
hailin 1f15daa6c5 fix(planting-records): filter only MINING_ENABLED records and fix UI overflow
- Backend: Add status filter to getPlantingLedger and getPlantingSummary
- Frontend: Change Row to Wrap for info items to prevent width overflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 00:12:07 -08:00
hailin 8ae9e217ff fix(mining-app): fix mining records data parsing from mining-service
Map miningMinute->distributionMinute, minedAmount->shareAmount,
secondDistribution->priceSnapshot to match entity fields

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 00:02:30 -08:00
hailin b310fde426 feat(mining-admin): show pending contribution in dashboard
- Add networkPendingContribution and networkBonusPendingContribution to API
- Display combined pending contribution (teamLevel + teamBonus) in stats card
- Replace 'total contribution' with 'pending contribution' in price overview

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:46:05 -08:00
hailin debc8605df fix(mining-app): rename MiningRecordsPage widget to avoid name conflict
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:33:38 -08:00
hailin dee9c511e5 feat(mining-admin): add total contribution to dashboard stats
- Add networkTotalContribution field to dashboard API response
- Display total hashrate alongside effective hashrate in stats cards
- Update price overview to show both effective and total contribution
- Change grid from 3 to 4 columns in price overview

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:32:29 -08:00
hailin 546c0060da feat(mining-app): add mining records and planting records pages
- Add mining records page showing distribution history with share amounts
- Add planting records page with adoption summary and detailed records
- Remove 推广奖励 and 收益明细 from profile page
- Add planting-ledger API endpoint and data models

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 23:23:31 -08:00
hailin b81ae634a6 fix(mining-app): hardcode team bonus tiers display to 15
- Profile page: 团队上级 shows '15' instead of actual unlockedBonusTiers
- Contribution page: 已解锁上级 shows '15级' instead of actual value

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 20:28:02 -08:00
hailin 0cccc0e2cd refactor(mining-app): rename VIP等级 to 团队上级 and 直推人数 to 引荐人数
- Changed "VIP等级" label to "团队上级" in profile stats row
- Changed display value from vipLevel (V3 format) to unlockedBonusTiers (raw number)
- Changed "直推人数" label to "引荐人数" for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 20:07:52 -08:00
hailin cd938f4a34 refactor(mining-app): rename team contribution labels
Update contribution page labels:
- "团队层级" → "团队下级"
- "团队奖励" → "团队上级"
- "直推人数" → "引荐人数"
- "已解锁奖励" → "已解锁上级" (with unit "档" → "级")
- "已解锁层级" → "已解锁下级"
- "直推及间推" → "引荐及间推" in subtitle

Update contribution records page labels:
- "团队层级" → "团队下级"
- "团队奖励" → "团队上级"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:58:41 -08:00
hailin 84fa3e5e19 refactor(mining-app): rename 绿积分 to 积分值 across all pages
Replace all occurrences of "绿积分" with "积分值" in:
- trading_page.dart (price display, pool name, input field)
- asset_page.dart (account labels)
- trading_account.dart (entity comment)
- price_info.dart (entity comment)
- market_overview.dart (entity comment)
- DEVELOPMENT_GUIDE.md (documentation)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:57:17 -08:00
hailin adeeadb495 fix(mining-app): update profile page - hide items and rename label
- Rename "团队层级" to "团队下级" in stats row
- Hide "实名认证" option from account settings
- Hide "我的邀请码" card section entirely
- Remove unused _buildInvitationCard and _buildActionButton methods

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:47:14 -08:00
hailin 42a28efe74 fix(mining-app): remove operator account note from expiration card
Remove the "运营账号贡献值永不失效" note from the contribution
expiration countdown card.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:28:31 -08:00
hailin 91b8cca41c feat(mining-app): implement hide/show amounts toggle
- Add hideAmountsProvider to control amount visibility
- Add tap handler to eye icon in total contribution card
- Toggle icon between visibility_outlined and visibility_off_outlined
- Hide amounts with **** when toggled in:
  - Total contribution value
  - Three column stats (personal, team level, team bonus)
  - Today's estimated earnings
  - Contribution detail summary rows

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:22:03 -08:00
hailin 02cc79d67a fix(mining-app): reduce bottom padding on navigation pages
Reduce bottom SizedBox from 100 to 24 on all four main navigation
pages (contribution, trading, asset, profile) to eliminate excessive
whitespace when scrolling to bottom.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 19:17:59 -08:00