Commit Graph

15 Commits

Author SHA1 Message Date
zerosaturation
3407e30395 refactor(assetService): CreateMintOrder 3-phase txn + orphan reconciliation (P0-2)
- CreateMintOrder 拆三段: txn1(PENDING→PROCESSING,不调RPC/不写asset)
  → 事务外 UpdateCrystalBalance 扣水晶 → txn2(建asset+registry→SUCCESS);
  消除 DB 事务内嵌跨服务 gRPC(连接池占用+跨服务事务风险)。
- 任一步失败 markMintOrderFailed 独立事务标 FAILED(不回滚已扣水晶=审计流水,
  重试靠 Task1 source_id 幂等 + Task2 入口短路防双扣); nil-cause 防御。
- 孤儿订单对账 ReconcileStuckMintOrders: 扫陈旧 PROCESSING 单,查 mint_cost 流水—
  已扣未建→FOR UPDATE 行锁下幂等补完 SUCCESS(串行化并发防双建),未扣→FAILED,绝不退款。
- main.go 接线周期 worker(MINT_RECONCILE_INTERVAL_SEC 默认600s,0关,优雅退出)。
- 测试: RPC失败落FAILED / 对账未扣→FAILED / 已扣未建→补完(含幂等二次跑)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-23 12:28:57 +08:00
zerosaturation
878bd46399 fix(backend): financial correctness — settlement/hours/mint idempotency (batch 1)
- settlement(1.1): exhibition_revenue_records 加 UNIQUE(exhibition_id,cycle_start_time)
  + CreateRevenueRecord ON CONFLICT DO NOTHING; MQ 用 settled_at 替代复用 is_processed;
  恢复扫描器过滤改 settled_at IS NULL; created_at 统一毫秒; 删死代码 cleanup_worker.go。
- hours(1.2): 新增 exhibition_hours_log/asset_exhibition_hours_log(source_id 唯一)幂等表;
  fan_profile/assetLevel 的 AddExhibitionHours 按 sourceID 幂等(事务包裹); 存量重算脚本。
- mint(1.4/1.5/1.6): crystal_transaction_records (source_id,change_type) 部分唯一索引
  + UpdateCrystalBalance/CreateMintOrder 幂等; 保底改 crypto/rand; 下线伪 tx_hash;
  doMint Redis Lua 原子限流。
- migrations 001/002/003; 各服务单测(自包含, 缺 DB t.Skip)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-23 01:11:54 +08:00
zerosaturation
271e0350c7 feat:重构code状态码 2026-06-15 16:28:35 +08:00
zerosaturation
0029fb8cc8 feat(statistic): T9-T12 dashboard 7 RPCs - additional business-side service modifications
Modifications to 5 existing business services for TrackEvent integration:
- socialService/asset_like_service.go: TrackEvent(asset.like) after LikeAsset
- galleryService/exhibition_service.go: TrackEvent(exhibition.start) + (exhibition.end with duration)
- taskService/revenue_service.go: TrackEvent(exhibition.revenue) after OnExhibitionCompleted
- assetService/mint_service.go: TrackEvent(asset.mint) after CreateMintOrder
- assetService/asset_level_service.go: TrackEvent(asset.level_up) in logLevelChange
- userService/user_service.go: fireCrystalChangeEvent wrapper (call site TBD by service owner)

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

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 17:20:53 +08:00
liulong
6ff8743c72 feat:修复合并问题 2026-06-03 23:25:08 +08:00
liulong
b9527bee70 feat:合并新 2026-06-03 22:41:19 +08:00
4aa11903f4 fix: 样式修复、创作者头像修复 2026-06-03 18:13:16 +08:00
liulong
889c9232fb feat:镭射新链路,旧链路清理,迁移脚本 2026-05-29 12:35:37 +08:00
zerosaturation
bee30a1824 feat: integrate asset level system with existing services
- mintService: Add AssetLevelService field and call GetOrCreateRecord after asset creation
- assetLikeService: Add AssetLevelService and call AddLikes/RemoveLikes in LikeAsset/UnlikeAsset
- revenueService: Add AssetLevelService and call AddExhibitionHours in OnExhibitionCompleted

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 19:03:31 +08:00
zerosaturation
ee0433464f feat: 修改铸造消耗确认框和新增批量购买道具的功能,修改回退按钮的颜色 2026-05-22 00:14:28 +08:00
zerosaturation
ca832abb2c feat: 新增每小时的收益字段 2026-05-19 12:17:57 +08:00
zerosaturation
2450fc1368 feat: 修改各种小bug 2026-05-17 23:33:45 +08:00
zerosaturation
45d3adc373 feat:添加光栅卡的选择 2026-05-17 19:03:34 +08:00
zerosaturation
cf8671b5bb 修改经验问题和光栅卡铸造bug修改 2026-05-16 04:32:43 +08:00
zerosaturation
afb235afd3 feat: 合并代码,解决冲突 2026-05-16 02:42:32 +08:00