|
|
25dacc066a
|
fix(dashboard): 按订单链路修正用户消费成本统计
将玩家消费排行榜和用户消费详情中的产出成本口径从 user_inventory 快照值改为订单抽奖链路成本。
排行榜按 user_id + 活动分类聚合,详情按 user_id + activity_id 聚合,成本统一基于已支付订单对应的 draw log、奖励配置、商品成本价、掉落数量和翻倍道具卡补量规则计算,使列表、详情与活动盈亏页的业务口径保持一致。
|
2026-04-13 19:23:13 +08:00 |
|
|
|
58fd926b46
|
fix(finance): 统一收益统计口径,修复多处数据计算错误
1. Revenue 口径统一为 actual_amount(真实现金到账)
- 优惠券(discount_amount)和积分(points_amount)是平台免费发放的营销补贴,
不算收入,改为展示字段
- 涉及: profit_metrics.go, dashboard_spending.go, users_profit_loss.go,
dashboard_user_spending.go, activity_rankings_admin.go
2. Cost 口径统一为奖品库存价值
- 删除 finance service 中的积分成本扫描(Step 3)和优惠券成本扫描(Step 4)
- 之前优惠券同时算在收入和成本两侧,导致利润被人为压低
- 涉及: query_user.go, query_activity.go
3. 统一 value_cents fallback chain
- finance service 改为与排行榜一致的三级回退:
COALESCE(NULLIF(value_cents,0), price_snapshot_cents, products.price, 0)
- 涉及: query_user.go, query_activity.go
4. 活动盈亏收入统一到 finance service
- 删除 dashboard_activity.go 自有的 revenue SQL(含比例分摊逻辑)
- 收入和成本统一由 finance.Service.QueryActivityProfitLoss() 提供
- 修复日志明细 profit:道具卡倍率改用 ComputePrizeCostWithMultiplier
5. finance service 新增展示字段
- ProfitLossDetail 增加 CouponDiscount, PointsDiscount, GamePassValue
- 不参与 Revenue/Cost/Profit 计算,仅供前端展示营销补贴明细
6. 修复对对碰次卡订单 discount_amount 数据污染
- matching_game_app.go 次卡下单时 DiscountAmount 错误设为活动全价
- 改为 0(次卡支付不涉及优惠券)
- 附带历史数据修复 migration SQL
7. 排除已分解奖品的成本重复计算
- 用户可以把奖品分解成积分再兑换新商品,导致同一份价值被计算两次
- 所有库存查询增加排除条件: status=3 且 remark 含 redeemed_points 或 batch_redeemed
- 涉及 6 个文件的库存成本/资产查询
8. 排行榜详情抽屉限定活动范围
- prize 查询增加 activity_id > 0 过滤,排除积分兑换/转入/合成等非活动产出
- 使排行榜与其详情抽屉口径一致
修改文件(12个):
- internal/service/finance/profit_metrics.go
- internal/service/finance/query_user.go
- internal/service/finance/query_activity.go
- internal/service/finance/types.go
- internal/api/admin/dashboard_activity.go
- internal/api/admin/dashboard_spending.go
- internal/api/admin/dashboard_user_spending.go
- internal/api/admin/users_profit_loss.go
- internal/api/admin/users_profile.go
- internal/api/admin/activity_rankings_admin.go
- internal/api/activity/matching_game_app.go
- migrations/20260325_fix_matching_gamepass_discount.sql
|
2026-03-26 00:01:17 +08:00 |
|
win
|
8d1eef2f7f
|
fix(channel): 修复渠道统计GMV重复计数和商城直购误计入
1. 排除商城直购(source_type=1):GMV和成本过滤条件从IN(1,2,3,4)改为IN(2,3,4)
2. 排除次卡免费使用订单(actual_amount=0):避免购买次卡和使用次卡双重计入GMV
- source_type=4 一番赏使用次卡:1578单 44032元重复
- source_type=3 对对碰使用次卡:422单 7042元重复
- 合计去除51074元虚增GMV(29.1%)
3. 成本过滤条件同步修正:source_type IN(2,3,4),total_amount>0
修正后:GMV从175600降至124527元,毛利率从37.4%回到真实的11.8%
|
2026-03-16 21:41:39 +08:00 |
|
win
|
46a7253239
|
fix:订单同步
|
2026-02-27 00:08:02 +08:00 |
|
win
|
8b7af03400
|
feat(prize): freeze value snapshots across grant redeem refund and reports
|
2026-02-21 22:16:20 +08:00 |
|
win
|
7e8a2ebb52
|
feat: Add user spending dashboard, update database schema, and refine various API endpoints and service logic.
|
2026-02-21 21:33:19 +08:00 |
|
|
|
9eea272d69
|
统计更新
|
2026-02-03 17:44:02 +08:00 |
|
|
|
1a8f94d7b8
|
fix
|
2026-01-29 19:25:16 +08:00 |
|
|
|
6d33cc7fd0
|
fix:盈亏计算
|
2026-01-27 01:33:32 +08:00 |
|
|
|
5ad2f4ace3
|
feat: 保存当前开发进度 - 直播抽奖验证功能
|
2026-01-18 01:55:54 +08:00 |
|
|
|
b21e2db8ef
|
feat: 添加抖音商品奖励功能,并增强后台用户列表统计数据、邀请人数及道具数量展示。
|
2026-01-08 10:13:29 +08:00 |
|