hailin
|
a01355aecc
|
fix(presence-service): JWT guard 向后兼容无 type 字段的旧 token
新 token 含 type:'access',旧 token 无 type 字段。
改为:只有 type 字段存在且不为 'access' 时才拒绝,
避免已登录用户因旧 token 格式导致心跳永久 401。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 21:16:01 -08:00 |
hailin
|
330f8c7681
|
fix(auth-service): JWT access token 加入 type/userId/accountSequence 字段
presence-service 的 JwtAuthGuard 校验 payload.type === 'access',
但之前 token 只有 sub/phone/source,导致心跳接口一直 401。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 21:09:24 -08:00 |
hailin
|
38423e7bf0
|
fix(mining-app): 删除 heartbeat_service 中未声明的 _apiBaseUrl 赋值
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 20:36:36 -08:00 |
hailin
|
7aa81bc5ab
|
fix(mobile-app): 初始化遥测时传入已登录用户ID,避免session_start丢失userId
从SecureStorage读取已存储的userSerialNum,在TelemetryService初始化时
传入,确保老token登录用户的session事件携带正确的user_id。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 20:19:57 -08:00 |
hailin
|
5e6ab25199
|
fix(mining-app): 前台回来时也上传遥测队列(大厂标准做法)
- 进入后台(paused)时立即 flush:session_end + 设备信息不丢失
- 回到前台(resumed)时立即 flush:上传被强杀遗留事件 + 新 session_start
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 20:07:11 -08:00 |
hailin
|
893513ad78
|
feat(presence): 添加设备档案表,实现事件流水+设备快照分离
大厂标准架构(Amplitude/Mixpanel):
- analytics_event_log: 事件流水(append-only,每条事件一行)
- analytics_device_profile: 设备快照(每台设备一行,upsert 更新)
设备分布查询从 O(events) 降为 O(devices):
- SELECT COUNT(*), device_brand FROM analytics_device_profile GROUP BY device_brand
不再需要 COUNT(DISTINCT install_id) 扫描全量事件表
ON CONFLICT (install_id) DO UPDATE:
- COALESCE 保留已有字段(不被 NULL 覆盖)
- last_seen_at 每次上报更新
- event_count 累加(可用于活跃度分析)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 19:31:33 -08:00 |
hailin
|
be415c1eb6
|
fix(mobile-app): 前台回来时也上传遥测队列(大厂标准做法)
进入前台时 flush 覆盖两种场景:
1. 上次 paused flush 因网络失败未上传的事件
2. 上次被强杀(force-kill)遗留在本地队列的事件
app_session_start 事件(含设备信息)也在此时立即上传,
无需等待10条阈值或30秒定时器。
参考:Amplitude/Mixpanel 均在 session start 时触发 flush。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 19:14:16 -08:00 |
hailin
|
9e90294d0e
|
fix(mobile-app): App进入后台时立即上传遥测队列
问题:TelemetryService.dispose()从未被调用,导致forceUploadAll()
永远不执行;uploadIfNeeded()有10条最小阈值,单次会话只有2-3条
事件无法触发上传,设备信息永远留在本地队列。
修复:进入后台(paused)结束session后,立即调用uploadBatch()
绕过10条阈值,确保每次App切换到后台时都能上报事件。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 19:11:25 -08:00 |
hailin
|
2c312a850b
|
fix(2.0): presence-service-2 使用 APP_PORT 指定监听端口
presence-service 的 main.ts 读取 APP_PORT 而非 PORT,
添加 APP_PORT: 3027 确保服务监听在正确端口。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 18:53:28 -08:00 |
hailin
|
b06f1272e2
|
feat(deploy): 注册 presence-service-2 到 deploy-mining.sh
- MINING_SERVICES 追加 presence-service-2 (port 3027)
- SERVICE_ALIASES 追加 presence / presence2 快捷名
- MINING_DATABASES 追加 rwa_mining_presence
- SERVICE_DB / SERVICE_PORTS 映射表同步更新
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 18:46:27 -08:00 |
hailin
|
5eb4afa2f9
|
feat(2.0): 为 2.0 部署独立的 presence-service-2
- 在 docker-compose.2.0.yml 添加 presence-service-2 (port 3027)
- 使用独立数据库 rwa_mining_presence,隔离 2.0 用户 DAU/在线数据
- Redis DB 17(2.0 其他服务已用 8,10,12,13,14,15,16)
- postgres-2 POSTGRES_MULTIPLE_DATABASES 追加 rwa_mining_presence
- 复用 presence-service 代码,与 auth-service 共享 JWT_SECRET
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 18:39:44 -08:00 |
hailin
|
b9cfa67835
|
docs(telemetry): 补充事件上报格式设计决策(Amplitude 风格顶层设备字段)
新增第三部分说明设备字段为何放顶层而非 JSONB properties:
- 对比 JSONB 与独立列在亿级数据下的查询性能差异
- 说明 toServerJson() 的提取原理(本地存储与服务端格式分离)
- 列出对应的数据库列定义和索引
- 各部分编号顺延
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:52:02 -08:00 |
hailin
|
6bca65e434
|
feat(telemetry): 设备字段提升为顶层结构化列(Amplitude 风格)
将 device_brand/device_model/device_os/app_version/locale 从 JSONB properties
提升为 analytics_event_log 表的独立列,并建立索引,支持亿级数据量下的高效
按设备维度查询和分组统计。
前端 (mining-app + mobile-app):
- toServerJson() 从 properties 中提取设备字段,以顶层字段发送给服务端
- 本地存储格式不变(properties 仍保留设备字段,便于离线队列完整性)
后端 (presence-service):
- Prisma schema: EventLog 新增 deviceBrand/deviceModel/deviceOs/appVersion/locale 列
- Migration: ALTER TABLE 添加 5 列 + 2 个索引
- DTO/Command: EventItemDto 接收顶层设备字段
- Entity: EventLog 新增 5 个字段及 getter
- Mapper: toDomain/toPersistence 映射新字段
- Handler: toEventLog 从 DTO 读取设备字段;SessionStartedEvent 优先使用顶层字段
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:50:48 -08:00 |
hailin
|
482df12f91
|
fix(telemetry): 将设备信息合并到每个事件的 properties 中上报服务端
设备信息(品牌/型号/OS/版本/语言)此前只存储在本地,对服务端分析毫无价值。
现在在 logEvent() 中将 deviceProps 合并到每个事件的 properties 字段,
使服务端 analytics 表能按设备维度进行统计分析。同时修复 _deviceContext 为
null 时的空指针异常(deviceContextId 使用 ?? '' 安全降级)。
适用于 mining-app 和 mobile-app 两端。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:42:14 -08:00 |
hailin
|
033d1cde42
|
feat(mining-app): 完善 telemetry 埋点 - 页面访问 + 用户行为
- 新增 TelemetryRouteObserver,挂载到 GoRouter 自动追踪全部页面访问
无需每个页面手动调用 logPageView(),覆盖 27 个路由
- user_providers: login_success/login_failed(区分密码/短信)、logout
- trading_page: buy_shares、sell_shares(含价格/数量/结果)、transfer_shares(含方向/金额/结果)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:36:04 -08:00 |
hailin
|
a2a318e24c
|
feat(mining-app): 集成 telemetry 遥测功能
- TelemetryService 添加 _accessToken 字段和 setAccessToken() 方法
- _getAuthHeaders() 现在返回 Bearer token 供心跳上报使用
- splash_page.dart: 启动时初始化 TelemetryService,已登录用户自动注入 userId 和 token
- user_providers.dart: 登录成功后注入 userId/token 并恢复上报;退出时暂停上报并清除 token;token 刷新时同步更新 telemetry token
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:29:06 -08:00 |
hailin
|
34603aac8e
|
fix(security): 修复修改登录密码页面加载失败时静默降级的 bug
与 change_payment_password_page 同款问题:加载失败时原本默默设为
hasPassword=true(注册时必须设置的假设),改为显示错误状态+重试按钮。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 09:17:53 -08:00 |
hailin
|
9c84be72bc
|
chore(presence-service): 更新 package-lock.json 以包含 @nestjs/jwt
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:59:34 -08:00 |
hailin
|
e8d9cb72a9
|
feat(presence-service): 修复鉴权——用户JWT验证心跳,管理员JWT查询在线/DAU数据
- 添加 @nestjs/jwt 依赖,AppModule 注册全局 JwtModule
- 重写 JwtAuthGuard:使用 JwtService.verifyAsync 解析用户 token (type=access)
- 新建 AdminGuard:验证管理员 token (type=admin),与 identity-service 共享 JWT_SECRET
- heartbeat 接口:保持 JwtAuthGuard(用户 JWT)
- online-count / online-history / dau:改用 AdminGuard(管理员 JWT)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:52:39 -08:00 |
hailin
|
5df9c97794
|
fix(account): 修复 verifyLoginPassword/verifyPaymentPassword 未读取 TransformInterceptor 包装层的 bug
后端 TransformInterceptor 将所有响应包装为 { success, data: <实际数据> },
但两个 verify 方法直接读 response.data['valid'],导致始终得到 null == true → false,
用户输入正确密码也显示"密码错误"。修复为读取 response.data['data']['valid']。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:47:17 -08:00 |
hailin
|
405e7e407e
|
fix(security): 修复支付密码页面加载失败时静默降级为设置模式的 bug
加载状态失败时改为显示错误提示和重试按钮,避免误导用户认为未设置支付密码。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:19:44 -08:00 |
hailin
|
a1d284b6b5
|
fix(password): 统一登录密码和支付密码状态查询为服务端 API
问题:
- isPasswordSet() 读 SecureStorage,重装/换设备后丢失 → 页面误判未设密码
- isPaymentPasswordSet() 读 response.data['isSet'],但实际格式为
{ success, data: { isSet } },取到 null → 始终返回 false
修复:
- 后端新增 GET /user/password-status 接口(isLoginPasswordSet 方法)
- 前端 isPasswordSet() 改为调用服务端 API
- 两个方法均使用正确的 response.data['data']['isSet'] 解包
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:14:24 -08:00 |
hailin
|
728b11c2aa
|
fix(payment-password): 修复 isPaymentPasswordSet 响应解析错误
API 返回 { success: true, data: { isSet: true } },
但代码读的是 response.data['isSet'](顶层),
实际应该读 response.data['data']['isSet'](嵌套在 data 下)。
导致 isSet 永远为 null == true → false,
支付密码页面始终显示「设置」模式而非「修改」模式。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 08:12:46 -08:00 |
hailin
|
5752f7b545
|
fix(telemetry): 冷启动会话恢复时注入 access token 到 TelemetryService
checkAuthStatus() 从 SecureStorage 读取 token 后,只设置了 userId
而未调用 setAccessToken,导致 App 冷启动后心跳一直返回 401。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 07:43:19 -08:00 |
hailin
|
37b11a3db6
|
feat(telemetry): 接通心跳服务的 JWT 认证,启用实时在线统计
- TelemetryService: 添加 _accessToken 缓存字段,实现 setAccessToken/clearAccessToken
- _getAuthHeaders(): 返回 Bearer token(原为空 {},导致心跳 401)
- AccountService: 3 处登录成功后同步调用 setAccessToken(response.accessToken)
- MultiAccountService: 账号切换后从 SecureStorage 读取恢复的 token 并注入;
账号删除时同步调用 clearAccessToken()
presence-service 后端待部署后,心跳将开始正常工作,实时在线数和 DAU 数据可用。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 07:20:05 -08:00 |
hailin
|
3aa2856770
|
fix(payment-password): 修复 isActive 字段名错误(应为 status !== ACTIVE)
Prisma schema 中 UserAccount 无 isActive 字段,实际为 status VARCHAR(20)。
两处 select 改为 { phoneNumber, status },检查改为 status !== 'ACTIVE'。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 07:05:42 -08:00 |
hailin
|
6f912b1232
|
feat(payment-password): 添加忘记支付密码功能(全栈)
后端(identity-service,纯新增):
- user-application.service 添加 2 个方法:
sendResetPaymentPasswordSmsCode(userId) —— 发送验证码到已绑定手机(Redis key 独立)
resetPaymentPassword(userId, smsCode, newPassword) —— 验证码校验 + 格式校验 + bcrypt 更新
- user-account.controller 新增 2 个端点(均为 @ApiBearerAuth):
POST /user/send-reset-payment-password-sms
POST /user/reset-payment-password
前端(mobile-app,纯新增):
- account_service 新增 sendResetPaymentPasswordSmsCode / resetPaymentPassword 两个方法
- 新建 reset_payment_password_page.dart:验证码 + 新6位PIN,重置成功后自动返回
- 路由:RoutePaths / RouteNames / AppRouter 各新增 resetPaymentPassword 条目
- change_payment_password_page:旧密码输入框下方添加「忘记支付密码?」入口链接
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 07:04:20 -08:00 |
hailin
|
71774f301d
|
fix(payment-password): 优化未设置支付密码时的错误提示
- 识别后端"尚未设置支付密码"异常,显示明确引导语
"请先前往「我的」→「支付密码」完成设置",替代误导性的"请检查网络"
- 简化空输入提示逻辑(直接使用 widget.hint)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 06:21:25 -08:00 |
hailin
|
cad7ebe832
|
feat(payment-password): 添加支付密码功能(全栈)
后端(identity-service):
- Prisma schema 新增 paymentPasswordHash 字段及手动迁移脚本
- user-application.service 添加 4 个方法:isPaymentPasswordSet / setPaymentPassword /
changePaymentPassword / verifyPaymentPassword(纯新增,不修改已有逻辑)
- user-account.controller 新增 4 个端点:
GET /user/payment-password-status
POST /user/set-payment-password
POST /user/change-payment-password
POST /user/verify-payment-password → { valid: bool }
前端(mobile-app):
- account_service 新增 4 个方法对应后端 4 个接口
- 新建 change_payment_password_page.dart:6 位数字支付密码设置/修改页面
- 路由:RoutePaths / RouteNames / AppRouter 注册 /security/payment-password
- profile_page:'修改登录密码' 改为 '修改密码',下方新增 '支付密码' 入口
- PasswordVerifyDialog:新增 title / subtitle / hint 可选参数,支持登录/支付双模式
- planting_location_page:认种确认改为验证支付密码(verifyPaymentPassword)
- pre_planting_purchase_page:预种确认后追加支付密码验证步骤
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 06:18:40 -08:00 |
hailin
|
d91ff7b83a
|
docs(mobile-app): 完善认种密码校验相关代码注释
- PasswordVerifyDialog: 补充类级文档、onVerify 字段说明、_handleConfirm 流程注释
- account_service.verifyLoginPassword: 补充参数、响应格式、行为说明
- planting_location_page._verifyPasswordThenSubmit: 说明在认种流程中的插入位置与作用
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:55:07 -08:00 |
hailin
|
3a84315b64
|
fix(mobile-app): verifyLoginPassword 读取响应体 valid 字段
后端 POST /user/verify-password 返回 { valid: bool },不用 HTTP 状态码区分,
修正响应解析逻辑。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:53:16 -08:00 |
hailin
|
41fa6349bd
|
feat(mobile-app): 认种确认前新增登录密码校验弹窗
- 新增 PasswordVerifyDialog 弹窗,风格与主体 App 一致
- account_service 新增 verifyLoginPassword() 调用 POST /user/verify-password
- planting_location_page 在 PlantingConfirmDialog 确认后插入密码校验步骤
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:51:47 -08:00 |
hailin
|
8de92f2511
|
fix(mining-app): 已解锁上 null 时显示 0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:41:00 -08:00 |
hailin
|
98c898769f
|
fix(mining-app): 已解锁上层数 = unlockedBonusTiers × 5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:40:00 -08:00 |
hailin
|
353299fd75
|
fix(mining-app): 已解锁上层数改为动态数据,替换硬编码的 15
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-05 05:13:10 -08:00 |
hailin
|
b67dfa0f4c
|
fix(planting-service+app): 合并列表补充 totalPortions,前端显示实际份数而非订单数
- getMerges 批量查来源订单 portionCount,按合并分组求和后返回 totalPortions
- 预种明细合并卡片改用 totalPortions 显示份数,fallback 才用订单数
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 08:58:45 -08:00 |
hailin
|
1f5bb62805
|
fix(contribution-service): 合并完成后写入 synced_adoptions 记录以解除卖出限制
swapContributionForMerge 在事务内新增步骤 9f:
- 写入 synced_adoptions(original_adoption_id = 20B + mergeId)
- 供 SellRestrictionService.isRestricted 的 has_real_tree 判断使用
- upsert 保证幂等,contributionDistributed 由调用方置 true
Bug: 合并已完成(contribution_records 正确),但 isRestricted 始终
返回 true,因为 synced_adoptions 中没有 20B+ 记录(virtualAdoption
仅用于计算,未持久化)。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 08:25:15 -08:00 |
hailin
|
94792f56ea
|
fix(contribution-service): 预种算力除数从 5 改为 10,冻结阈值同步更新
- PRE_PLANTING_PORTION_DIVISOR: 5 → 10(每份算力 = 1棵树的 1/10)
- 冻结条件:totalPortions < 5 → < 10
- 解冻条件:totalPortions >= 5 → >= 10
- 同步更新所有相关注释和日志文案
注:2026-03-02 前已分配的份额算力记录(按 1/5 计算)不追溯修正。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 08:04:42 -08:00 |
hailin
|
2b07219046
|
fix(mining-app): sellRestrictionProvider 绑定用户身份,避免跨账号缓存污染
[问题] sellRestrictionProvider 未绑定用户身份。若先用预种账号(isRestricted=true)
测试,再切换为正式认种账号,Riverpod keepAlive 缓存会在 2 分钟内残留上一个用户
的 true 值,导致正式认种用户错误看到预种卖出限制提示。
[修复] 在 provider 内 watch userNotifierProvider.select((s) => s.accountSequence),
accountSequence 变化(登录/切换账号)时 provider 自动失效并重新请求。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 07:29:12 -08:00 |
hailin
|
59097203ae
|
fix(app): 预种计划入口移至自助申请授权页市团队下方
## 问题
上一版错误将「申请预种计划」入口放在「我」页面主区域,
实际需求是放在「自助申请授权」页的「申请市团队」卡片下方。
## 改动内容
### authorization_apply_page.dart
- import route_paths.dart
- `_buildAuthorizationTypes()` 将 `.map()` 展开为 for 循环,
在 AuthorizationType.cityTeam item 渲染完后插入 `_buildPrePlantingEntry()`
- 新增 `_buildPrePlantingEntry()` 方法:
· 样式:金色(0xFFD4AF37)卡片,左侧图标圆角背景 + 右侧箭头,
副标题「购买预种份额 · 查看明细 · 团队预种统计」
· 点击跳转 RoutePaths.prePlantingHub(预种计划 Hub 页)
### profile_page.dart(撤销上一版在主页的改动)
- 移除 `bool _isPrePlantingActive` 状态变量
- 移除 `_loadPrePlantingConfig()` 方法及 initState 调用
- 移除布局中的预种入口按钮区块
- 移除 `_buildPrePlantingEntryButton()` 方法
Hub 页面(pre_planting_hub_page.dart)和路由定义保持不变,
入口位置从「我」主页改为自助申请授权页的市团队下方。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 07:03:59 -08:00 |
hailin
|
8b48d80cd4
|
feat(app): 预种计划三按钮合并为单入口 Hub 页面
## 背景
「我」页面原有三个并排的预种按钮(预种购买 / 预种明细 / 团队预种),
三等分宽度导致文字拥挤,视觉层级也不清晰。
## 改动内容
### 新增文件
- `pre_planting_hub_page.dart`
预种计划 Hub 汇总页,竖排展示三个功能入口卡片:
· 预种购买(金色)→ /pre-planting/purchase
· 预种明细(棕色)→ /pre-planting/position
· 团队预种(绿色)→ /pre-planting/team
页面为纯导航页,无需加载数据;风格与 pre_planting_purchase_page
一致(渐变背景、金色「← 返回」Header、Inter 字体)。
### 修改文件
- `route_paths.dart` / `route_names.dart`
新增路由常量 prePlantingHub = '/pre-planting/hub'
- `app_router.dart`
注册 GoRoute(path: prePlantingHub) → PrePlantingHubPage
新增对应 import
- `profile_page.dart`
· 删除 `_buildPrePlantingButtons()`(三按钮并排 Widget)
· 删除已无用的三个导航方法:
_goToPrePlantingPurchase / _goToPrePlantingPosition / _goToTeamPrePlanting
· 新增 `_buildPrePlantingEntryButton()`:
满宽 48px 按钮,文字「申请预种计划」,点击跳转 Hub 页
· 布局调用处改为 _buildPrePlantingEntryButton()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 06:42:50 -08:00 |
hailin
|
979ba379c1
|
fix(text): 预种合并份数从5份改为10份
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 06:18:12 -08:00 |
hailin
|
867d4853ae
|
fix(trading-service): 补充 CONTRIBUTION_SERVICE_URL 环境变量
trading-service 调用 contribution-service 做预种卖出限制检查时,
因缺少 CONTRIBUTION_SERVICE_URL 导致 fallback 到 localhost:3020,
在 Docker 网络中无法连通,造成 fail-open 放行所有卖出。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 06:09:47 -08:00 |
hailin
|
4904337e97
|
revert(app): 回滚 C2C 页面的卖出限制
C2C 卖出的是积分值,不是积分股,不受预种卖出限制约束。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 05:57:24 -08:00 |
hailin
|
ee734fb7b9
|
feat(trading+app): 预种卖出限制 — 前端 UI 禁用 + 后端查询端点
trading-service:
- asset.controller.ts: 新增 GET /asset/sell-restriction,供 mobile app 查询当前用户限制状态
- application.module.ts: 导出 TradingSellRestrictionService
mining-app:
- api_endpoints.dart: 新增 sellRestriction 端点常量
- trading_remote_datasource.dart: 新增 getSellRestriction()(fail-open)
- trading_repository.dart/impl: 新增接口与实现
- trading_providers.dart: 新增 sellRestrictionProvider(2分钟缓存,fail-open)
- trading_page.dart: 卖出限制时显示红色提示文字并禁用"确认交易"按钮
- c2c_publish_page.dart: 发布卖出广告时显示红色提示文字并禁用发布按钮
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 05:51:56 -08:00 |
hailin
|
ac3adfc90a
|
feat(pre-planting): 新增预种积分股卖出限制(方案B纯新增)
限制仅有预种份数(未合并成棵)的用户卖出积分股,
直到用户完成首次预种合并后方可卖出。
=== 改动范围(全部 2.0 系统,纯新增)===
contribution-service:
- prisma/pre-planting/schema.prisma: 新增 PrePlantingSellRestrictionOverride 模型
- migrations/20260304000000: 对应建表 SQL
- src/pre-planting/application/services/sell-restriction.service.ts: 核心判断逻辑
isRestricted = has_pre_planting_marker AND !has_real_tree AND !admin_override
- src/api/controllers/pre-planting-restriction.controller.ts: 暴露内部接口
GET /api/v2/pre-planting/sell-restriction/:accountSequence (@Public)
POST /api/v2/pre-planting/sell-restriction/:accountSequence/unlock (@Public)
- src/api/api.module.ts: 注册新 controller 和 SellRestrictionService
trading-service:
- src/application/services/sell-restriction.service.ts: HTTP + Redis 缓存(TTL 60s)
fail-open:contribution-service 不可用时允许卖出,保障业务连续性
- src/application/services/order.service.ts: 卖单前增加限制检查(4行)
- src/application/application.module.ts: 注册 TradingSellRestrictionService
mining-admin-service:
- src/application/services/pre-planting-restriction.service.ts: 代理接口 + 审计日志
每次管理员解除操作均写入 AuditLog,保证严格可追溯性
- src/api/controllers/pre-planting-restriction.controller.ts:
GET /pre-planting-restriction/:accountSequence
POST /pre-planting-restriction/:accountSequence/unlock
- api.module.ts / application.module.ts: 注册新服务和接口
mining-admin-web:
- users.api.ts: 新增 getPrePlantingRestriction / unlockPrePlantingRestriction
- use-users.ts: 新增 usePrePlantingRestriction / useUnlockPrePlantingRestriction hooks
- users/[accountSequence]/page.tsx: 受限时在基本信息卡显示红色警告 + 解除按钮
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-04 05:04:57 -08:00 |
hailin
|
8fcfec9b65
|
fix(contribution): backfill 强制重算 unlock status,修复预种用户层级卡在5级的问题
问题根因:直推用户先买预种导致 directReferralAdoptedCount 已累加到正确值(如5),
但 markAsAdopted() 随后被调用时硬编码 level=5/bonus=1,覆盖了正确的解锁状态。
之后 backfill 因 count 未变(5>5=false)永远不触发重算,level 永久卡死。
修复:updateAccountUnlockStatus 改用 setDirectReferralAdoptedCount() 替代
incrementDirectReferralAdoptedCount 循环,无论 count 是否变化都强制调用
updateUnlockStatus() 重算 unlockedLevelDepth 和 unlockedBonusTiers。
同时为 getDirectReferralAdoptedCount 补充注释,说明常规认种和预种均按人头计。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-03 23:16:47 -08:00 |
hailin
|
728728bee3
|
fix(admin-service): 个人/团队认种数量改为统计棵数而非订单数
【问题】
getUserList 及推荐树节点中「个人认种」「团队认种」显示的是订单条数
(_count: { id }),而非实际认种棵数。一笔订单可认种多棵,导致多棵
合并下单的用户数量严重偏低。
【修复】
将以下方法中的所有 count(orders) 改为 sum(treeCount):
- getPersonalAdoptionCount — 用户详情页个人认种数
- getTeamStats — 用户详情页团队认种数
- getBatchUserStats — 用户列表批量统计(个人/团队/省/市认种数)
- getAncestors — 推荐树祖先节点认种数
- getDirectReferrals — 推荐树直推节点认种数
【影响范围】
仅影响 admin-web 管理后台的展示数据,不涉及业务逻辑和数据存储。
省市认种百分比计算基准同步修正(teamAdoptions 也改为棵数),
比例结果不变,但基数更准确。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-03 22:29:32 -08:00 |
hailin
|
f8f37a2e33
|
fix(admin-web): 推荐树节点「团队预种」显示时减去本人份数
后端返回的 teamPrePlantingPortions 包含该节点自身的 selfPrePlantingPortions,
导致管理后台推荐树中「团队预种」数量比实际多出本人的份数。
修复:推荐树展示层(祖先节点 + 直推/展开节点两处)统一改为:
团队预种显示值 = teamPrePlantingPortions - selfPrePlantingPortions
用户详情卡片顶部的原始统计数字保持不变(供管理员核查原始数据)。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-03 22:19:05 -08:00 |
hailin
|
3f4b22b013
|
docs(contribution): add detailed comments for backfill task and findAccountsWithIncompleteUnlock
Explain the starvation root cause, unlock rules, pre-planting user scenario,
and future scalability considerations (cursor-based pagination).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-03-03 21:58:52 -08:00 |