Commit Graph

2029 Commits

Author SHA1 Message Date
hailin 5fa0fd5d1a fix(mining): 为 HEADQUARTERS 账户添加每分钟挖矿记录
HEADQUARTERS 的挖矿收益来自待解锁算力,之前只更新了账户余额,
但没有写入 system_mining_records 表的每分钟汇总记录。

现在在两个分发路径中都为 HEADQUARTERS 调用 accumulateSystemMinuteData,
确保前端能正确显示总部账户的挖矿记录。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 17:25:07 -08:00
hailin 1d5e3ebff2 fix(contribution): 使用 upsert 替代 update 避免记录不存在错误
将 addContribution 方法改为 upsert,当系统账户不存在时自动创建,
存在时增加算力余额。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 08:43:37 -08:00
hailin 5ec310124d fix(contribution): 确保 HEADQUARTERS 账户存在后再更新算力
修复 Record to update not found 错误,在调用 addContribution 前
先调用 ensureSystemAccountsExist 确保系统账户记录已创建。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 08:42:02 -08:00
hailin d844228711 fix(contribution): 将未分配算力汇总到总部账户(HEADQUARTERS)
之前 HEADQUARTERS 账户在算力分配时被遗漏,未获得未分配算力的汇总。
现在在保存未分配算力时,同时更新 HEADQUARTERS 账户的 contributionBalance,
并发布同步事件用于 mining-admin-service 同步。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 08:26:53 -08:00
hailin e8e1193387 fix(trading): 添加 original_quantity 数据库迁移文件
修复服务器上缺少 trades.original_quantity 列的问题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 08:21:29 -08:00
hailin 6c77828944 fix(deploy): 完善 cdc-resnapshot 自动从配置文件创建连接器
- 修复 database.hostname: postgres -> rwa-postgres
- cdc-resnapshot 现在会自动检查连接器是否存在
- 如果连接器不存在,自动从配置文件创建(使用 snapshot.mode=always)
- 修复连接器映射到配置文件的逻辑

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:55:19 -08:00
hailin 60f2c29ad8 fix(deploy): 修复 CDC 全量同步问题
问题:
- CDC_CONSUMER_GROUPS 缺少阶段性消费者组,导致 full-reset 时
  未重置 contribution-service-cdc-phase-* 消费者组
- 当 Kafka topic 数据丢失时,无法触发 Debezium 重新快照

修复:
- 添加阶段性消费者组到 CDC_CONSUMER_GROUPS
- 添加 CDC_POSTGRES_CONNECTORS 列表
- 新增 cdc-resnapshot 命令,用于强制 Debezium 重新快照

使用方法:
- ./deploy-mining.sh full-reset      # 完整重置
- ./deploy-mining.sh cdc-resnapshot  # Kafka 数据丢失时触发重新快照

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 07:38:21 -08:00
hailin 5668de0a58 fix(asset): formatCompact保留原始精度(最多8位小数)
修复资产页面累计卖出等数字显示没有小数位的问题

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 05:27:50 -08:00
hailin 995dfa898e feat(trading): 添加涨跌幅显示及修复成交明细数据
1. 后端:
   - 添加 getFirstSnapshot() 获取上线首日价格
   - PriceInfo 接口增加 priceChangePercent 和 initialPrice 字段
   - 计算涨跌幅 = (当前价格 - 首日价格) / 首日价格 × 100%
   - 修复 originalQuantity 为0时的数据计算逻辑

2. 前端:
   - 交易页面涨跌幅移到价格下方单独显示
   - 添加"较上线首日"说明文字
   - 根据涨跌正负显示不同颜色和图标

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 05:24:23 -08:00
hailin 7ff7157115 refactor(ui): 隐藏"我的"页面中的"同伴与收益"栏
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:44:16 -08:00
hailin e1cc364b0d refactor(ui): 兑换页面文案调整
- 标题"积分股交易"改为"积分股兑换"
- "当前积分股价格"改为"当前积分股价值"
- 移除价格前的¥符号

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:43:08 -08:00
hailin 93c06920bd refactor(ui): 引荐人数改为引荐
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:32:48 -08:00
hailin 9fb51fa30a fix(ui): 恢复同伴下贡献值统计卡片的两行布局
- 恢复"已解锁上"项(去掉"级"字)
- 保持两行四项布局:引荐人数、已解锁上、已解锁下、是否参与

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:31:54 -08:00
hailin 33bf14b225 refactor(ui): 调整同伴下贡献值统计卡片
- 删除"已解锁上级"项
- "引荐人数"去掉"人"单位
- "已解锁下级"改为"已解锁下"
- 三个统计项改为单行显示

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:29:40 -08:00
hailin 728497afc1 refactor(ui): 将"个人"替换为"本人"
- team_tree_widget.dart: 节点详情弹窗中"个人参与"改为"本人参与"
- team_page.dart: 统计卡片中"个人参与"改为"本人参与"
- contribution_page.dart: 贡献值统计中"个人贡献值"改为"本人贡献值","个人参与产生的贡献值"改为"本人参与产生的贡献值"
- contribution_records_page.dart: 筛选标签"个人"改为"本人",来源类型标签"个人参与"改为"本人参与"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:28:10 -08:00
hailin 9c705d7478 fix(ui): 将UI界面上所有"团队"替换为"同伴"
- team_tree_widget: 团队参与 → 同伴参与
- contribution_records_page: 团队下/上贡献值 → 同伴下/上贡献值
- about_page: 团队收益 → 同伴收益
- help_center_page: 团队收益/计算 → 同伴收益/计算
- contribution_page: 团队下/上贡献值 → 同伴下/上贡献值
- team_page: 我的团队 → 我的同伴, 团队参与 → 同伴参与
- profile_page: 团队与收益 → 同伴与收益, 我的团队 → 我的同伴
- contribution_record: 团队奖励/额外奖励 → 同伴奖励/额外奖励

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:24:54 -08:00
hailin 21e536d829 fix(ui): 移除所有人民币符号,统一使用积分值单位
- asset_page: 总资产估值改为显示"积分值"后缀
- asset_page: 估值占位符移除¥符号
- c2c_publish_page: 交易总额、单价、总额改为积分值单位

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:19:52 -08:00
hailin 14d29b62ef fix(asset): 隐藏总资产卡片的每秒增长显示
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:16:42 -08:00
hailin 1aa655f243 fix(asset): 移除积分值冗余的人民币估值显示
积分值与人民币1:1对应,不需要显示"≈ ¥xxx"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:15:11 -08:00
hailin 8728fdce4c feat(trading): 成交明细显示完整卖出信息(销毁倍数、有效积分股、手续费等)
- 后端Trade表新增originalQuantity字段存储原始卖出数量
- quantity字段改为存储有效积分股(含销毁倍数)
- API返回完整明细:销毁倍数、有效积分股、交易总额、进入积分股池
- 前端成交明细页面显示完整卖出信息,类似确认卖出弹窗样式

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 04:07:52 -08:00
hailin 7da98c248b feat(trading): 交易记录页面添加成交明细Tab,显示手续费
后端:
- trading-service 添加 GET /trading/trades API 获取成交记录
- 成交记录包含: 交易总额、手续费(10%)、实际收到金额

前端:
- 新增 TradeRecord 实体和 TradesPageModel
- 交易记录页面添加 Tab: "订单记录" 和 "成交明细"
- 成交明细显示: 价格、数量、交易总额、手续费、实际收到

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 03:15:25 -08:00
hailin 63e02666ea fix(asset): 积分股估值计算加入倍数(burnMultiplier)
之前只用了 shareBalance * currentPrice,
正确公式应该是 shareBalance * (1 + burnMultiplier) * currentPrice

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 03:07:03 -08:00
hailin 1c787a22a3 fix(mining): 修复 mining-service 订阅错误的 Kafka topic
问题:mining-service 订阅的是 cdc.contribution.outbox (Debezium CDC topic),
但 contribution-service 使用 Outbox Pattern 直接发送到 contribution.{eventType} topic。

修复:
- mining-service 订阅正确的 topic 列表
- 修复消息解析逻辑支持 Outbox Pattern 消息格式
- contribution-service 添加 GET /admin/unallocated-contributions 端点(调试用)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 03:03:17 -08:00
hailin 0fddd3164a fix(trading): 交易记录金额单位从USDT改为积分值
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 02:18:40 -08:00
hailin b1d8561ca5 fix(asset): 积分股估值显示积分值而非人民币
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 02:17:22 -08:00
hailin edfdb1a899 fix(asset): 冻结积分值为0时状态显示为"无"而非"挂单中"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 02:16:35 -08:00
hailin 94d283696f fix(tss): 修复备份恢复后签名失败的问题
问题原因:
- 备份恢复的钱包在签名时使用了当前设备的 partyId,而不是原始 keygen 时的 partyId
- TSS 协议要求签名时使用的 partyId 必须与 keygen 时完全一致

修复内容:
- Android: joinSignSessionViaGrpc() 使用 shareEntity.partyId 而非当前设备 partyId
- Electron: cosign:joinSession 和 cosign:createSession 使用 share.party_id
- Electron: handleCoSignStart() 使用 share.party_id 进行签名
- 所有 gRPC 通信和消息订阅都使用原始 partyId

关键修改点:
- TssRepository.kt: joinSignSessionViaGrpc() 第 1136 行使用 signingPartyId
- main.ts: cosign:joinSession 第 1826 行使用 signingPartyId
- main.ts: cosign:createSession 第 1624-1633 行使用 share.party_id
- main.ts: handleCoSignStart() 第 836 行使用 share.party_id

其他:
- 移除 Android APK 中的 x86_64 ABI (仅用于模拟器)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 00:39:05 -08:00
hailin c5db77d23a feat(tss): 添加积分股(eUSDT)和积分值(fUSDT)代币支持
新增功能:
- 添加 ENERGY_POINTS (积分股/eUSDT) 和 FUTURE_POINTS (积分值/fUSDT) 代币类型
- 实现所有 ERC-20 代币的通用余额查询功能
- 支持四种代币的转账功能 (KAVA, dUSDT, eUSDT, fUSDT)
- 更新 UI 显示所有代币余额和代币选择器

代币合约地址 (Kava EVM):
- dUSDT (绿积分): 0xA9F3A35dBa8699c8E681D8db03F0c1A8CEB9D7c3
- eUSDT (积分股): 0x7C3275D808eFbAE90C06C7E3A9AfDdcAa8563931
- fUSDT (积分值): 0x14dc4f7d3E4197438d058C3D156dd9826A161134

技术改进:
- 添加 TokenConfig 工具类统一管理代币配置
- 添加 ERC20Selectors 常量类定义合约方法选择器
- 添加 transaction_records 表用于存储转账历史 (数据库版本升级到 v4)
- 重构余额查询和转账逻辑支持多代币类型
- 所有 ERC-20 代币使用 6 位小数精度

受影响文件:
- Android: Models.kt, TssRepository.kt, TransactionUtils.kt, Database.kt,
          AppModule.kt, TransferScreen.kt, WalletsScreen.kt
- Electron: transaction.ts, Home.tsx

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 23:36:58 -08:00
hailin d332ef99a7 feat(auth): 隐藏验证码登录和注册功能
- 移除登录方式切换(验证码登录选项卡)
- 隐藏注册入口
- 简化登录页面,仅保留密码登录
- 清理未使用的变量和方法

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 23:10:24 -08:00
hailin d31bfc4221 feat(c2c): 修改C2C交易为积分值并添加绿积分支付方式
- C2C交易的商品从积分股改为积分值
- 添加绿积分作为默认且不可取消的支付方式
- 添加1.0系统ID输入框(绿积分支付必填)
- 支持多种支付方式同时选择
- 更新交易提示说明

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 23:07:35 -08:00
hailin 9333cd81c3 fix(kline): auto-load more history when data doesn't fill screen
- Always assume hasMoreHistory=true on initial load
- Auto-trigger loadMoreHistory when klines don't fill drawable area
- This ensures sparse data periods load all available history

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 22:53:48 -08:00
hailin 84d920f98f fix(kline): stop loading when no unique new history data
When deduplicated new klines are empty, mark hasMoreHistory as false
to prevent infinite loading attempts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 22:31:38 -08:00
hailin 13f1b687ee feat(kline): add dynamic history loading on pan
Add support for loading more K-line history data when user pans to the
left edge. Backend API now accepts 'before' parameter for pagination.
Frontend uses KlinesNotifier to manage accumulated data with proper
deduplication.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 22:21:39 -08:00
hailin 99c1ff1fb7 fix(kline): convert time to local timezone for display
- Added toLocal() conversion in _formatTimeLabel (painter)
- Added toLocal() conversion in _formatDateTime (widget)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:55:56 -08:00
hailin 900ba4a555 feat(kline): add dynamic X-axis time labels
- Added _drawTimeAxis method to render time labels
- Labels dynamically adjust spacing based on candleWidth
- Shows HH:MM format, or M/D for midnight
- Labels follow pan/zoom movements
- Increased bottomPadding to 20px for label space

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:51:23 -08:00
hailin 453cab71e4 chore: remove debug logging from kline pan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:49:34 -08:00
hailin f55fb13f26 feat(kline): implement true pan effect with scrollOffset
- Added scrollOffset parameter to KlinePainter and KlineVolumePainter
- Painters now draw all klines and apply scrollOffset for positioning
- Added canvas clipping to prevent drawing outside chart bounds
- Removed _getVisibleData and related helper methods (no longer needed)
- scrollOffset directly controls the visual position of all klines

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:43:45 -08:00
hailin 48ba72ce89 fix(kline): simplify pan logic - scrollX now always controls view position
- Removed _userHasPanned flag and special handling
- _scrollX is initialized in _scrollToCenter() at startup
- Pan gesture directly modifies _scrollX
- _getVisibleData() always uses _scrollX to calculate visible range

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:35:31 -08:00
hailin 7ae58e98e6 debug: 添加平移调试信息 2026-01-19 21:30:41 -08:00
hailin 684367941d feat(kline): 支持左右平移查看历史K线
- 初始状态:最新K线在屏幕中心(保持原有逻辑不变)
- 用户平移后可查看全部历史数据
- 切换周期时重置平移状态

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 21:25:59 -08:00
hailin f149c2a06a fix(kline): 数据量大时只取最近数据,让最新K线在屏幕中心
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 20:39:33 -08:00
hailin a15ab7600f fix(kline): 修正K线显示逻辑,从左开始排列,最新K线居中
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 20:26:20 -08:00
hailin f51aa44cd9 feat(frontend): K线图组件支持深色模式
- kline_chart_widget.dart: 使用 AppColors 动态颜色,传递 isDark 参数
- kline_painter.dart: 添加 isDark 参数,网格/文字/十字线颜色随主题变化
- kline_volume_painter.dart: 添加 isDark 参数,成交量图颜色随主题变化

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 19:42:52 -08:00
hailin 2745995a1a feat(frontend): 贡献值页面完整支持深色模式
- 所有卡片背景使用 AppColors.cardOf(context) 动态颜色
- 所有文字颜色改用动态方法 textPrimaryOf/textSecondaryOf/textMutedOf
- 图标背景透明度根据深色模式调整 (isDark ? 0.2 : 0.1)
- 分隔线和边框使用 AppColors.borderOf(context)
- 移除未使用的静态颜色常量

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 19:32:06 -08:00
hailin 61203d1baf feat(frontend): extend dark mode support to more pages
- Update asset_page.dart with full dark mode support
- Update c2c_market_page.dart with full dark mode support
- Update login_page.dart with full dark mode support

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 19:21:40 -08:00
hailin b0d1771b66 fix(contribution): 恢复静态颜色常量避免编译错误
保留原有浅色模式配色(_grayText, _darkText, _bgGray, _lightGray),
页面背景已支持深色模式切换

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 19:10:13 -08:00
hailin bbe1754309 feat(frontend): 添加全局深色模式支持
核心改动:
1. app_colors.dart - 添加浅色/深色两套色彩常量和动态颜色获取方法
   - backgroundOf()、surfaceOf()、cardOf() 等方法根据主题返回对应颜色
   - 浅色:#F3F4F6背景、#FFFFFF卡片、#1F2937文字
   - 深色:#111827背景、#1F2937卡片、#E5E7EB文字

2. main.dart - 更新 ThemeData 配置
   - 添加 scaffoldBackgroundColor、appBarTheme、cardTheme 等深色主题配置

3. main_shell.dart - 导航栏支持深色模式
   - 使用 AppColors 动态方法替换硬编码颜色

4. trading_page.dart - 兑换页面支持深色模式
   - 所有卡片、文字颜色使用动态颜色方法
   - 划转弹窗也支持深色模式

5. contribution_page.dart - 贡献值页面开始支持(部分)

后续需要继续更新其他页面以完整支持深色模式切换

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 19:08:03 -08:00
hailin a47b935bce fix(tss-android): 修复备份恢复后无法签名的问题
问题原因:
备份数据中缺少 partyId 字段。恢复到新手机后,签名时使用的是新设备
生成的 partyId,而不是 keygen 时编码到 LocalPartySaveData 中的
原始 partyId,导致 TSS 签名协议无法正确匹配密钥数据而失败。

修复内容:
1. Models.kt:
   - ShareRecord 添加 partyId 字段
   - ShareBackup 添加 partyId 字段,备份格式版本升级到 v2
   - 更新 fromShareRecord() 和 toShareRecord() 方法

2. Database.kt:
   - ShareRecordEntity 添加 party_id 列
   - 数据库版本升级到 3

3. AppModule.kt:
   - 添加 MIGRATION_2_3 数据库迁移脚本

4. TssRepository.kt:
   - 添加 currentSigningPartyId 成员变量跟踪当前签名使用的 partyId
   - keygen 保存时包含 partyId (3处)
   - 备份导入时保存原始 partyId
   - 签名流程使用 shareEntity.partyId 替代设备 partyId (3处)
   - gRPC 调用 (markPartyReady, reportCompletion) 使用原始 partyId

关键点: 签名时必须使用 keygen 时的原始 partyId,因为该 ID 被编码
到了 TSS 密钥数据结构中。现在备份会保存此关键字段,恢复后签名
将使用正确的 partyId。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:56:27 -08:00
hailin b00de68b01 refactor(profile): 重新实现深色模式,保留原有浅色模式配色
问题:之前的深色模式实现使用了 colorScheme,导致浅色模式的原有配色也被改变

修复方案:
- 定义浅色/深色两套色彩常量,浅色模式使用原有设计色值
- 添加基于 Theme.brightness 的颜色辅助函数动态返回对应颜色
- 浅色模式:保持原有 #1F2937/#6B7280/#9CA3AF/#F3F4F6/白色配色
- 深色模式:使用 #E5E7EB/#9CA3AF/#6B7280/#111827/#1F2937 配色
- 所有 widget 方法更新为使用动态颜色函数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:44:31 -08:00
hailin d8df50a68f fix(c2c): 修复分页参数类型转换问题导致的500错误
- 为 QueryC2cOrdersDto 和 QueryMyC2cOrdersDto 的 page/pageSize 字段添加 @Type(() => Number) 装饰器
- Query参数从URL获取时默认为字符串,需要显式转换为数字类型
- 添加 @IsInt() 验证确保参数为整数
- 修复 Prisma findMany take 参数期望 Int 但收到 String 的错误

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 18:32:38 -08:00