|
|
53e5d81fa8
|
fix(auth): 商品详情接口移至公开路由,修复未登录浏览触发登录弹窗
问题背景:
- 平台审核失败,原因:小程序页面未完整浏览即要求授权登录,属于登录规范不合规
- GET /api/app/products/:id 位于认证路由组,未登录用户访问返回 401,
触发前端全局拦截器弹出"账号登录已过期"弹窗
修改内容:
1. router.go: 将 GET /products/:id 从 appAuthApiRouter(认证组)
移至 appPublicApiRouter(公开组),允许未登录用户浏览商品详情
2. product.go: 针对公开端点增加安全加固
- 增加商品 ID 参数校验(ParseInt 错误和 id<=0)
- 将兜底错误信息从 validation.Error(err) 改为通用提示
"商品信息获取失败",防止原始 DB 错误泄露给未认证请求
影响范围:
- 仅影响 GET /api/app/products/:id 端点
- GET /api/app/products(商品列表)仍保留在认证组
- 该 handler 不依赖 JWT session 上下文,移至公开组后功能无变化
- 返回数据仅包含商品元信息(名称、图片、价格、库存),不含用户敏感数据
|
2026-03-26 14:35:25 +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 |
|
|
|
be245c1476
|
feat(rewards): API 返回奖品参考价字段 price_snapshot_cents
rewards 接口的 rewardItem 新增 price_snapshot_cents 字段,
将数据库中的商品价格快照(分)暴露给前端用于展示参考价。
|
2026-03-25 22:01:28 +08:00 |
|
|
|
46b9555823
|
feat(fragment): 商品成本价 + 活动奖品单次产出数量
- products 表新增 cost_price 字段(成本价/分)
- activity_reward_settings 新增 drop_quantity(单次产出数量,默认1)
和 cost_snapshot_cents(成本价快照)
- 奖品创建/修改时自动快照成本价,drop_quantity 限制 1-100
- 抽奖发放逻辑按 drop_quantity 循环创建多个库存项
- 抽奖结果接口按 drop_quantity 返回多条 item,前端自动合并显示
- 抽奖记录接口返回 drop_quantity 字段
- 商品管理 API 全链路支持 cost_price
|
2026-03-23 22:26:06 +08:00 |
|
win
|
2a7b731484
|
feat(finance): implement Phase 1 core P&L service + wire into dashboard
- Add internal/service/finance/types.go: AssetType enum, param/result structs
- Add internal/service/finance/service.go: Service interface, read-only ctor
- Add internal/service/finance/query_user.go: QueryUserProfitLoss (4 fan-out scans)
- Add internal/service/finance/query_activity.go: QueryActivityProfitLoss (4 fan-out scans)
- Add internal/service/finance/service_test.go: 22 integration tests (all pass)
- Wire finance.Service into admin handler (admin.go)
- Replace dashboard_activity cost scan with finance.Service call (D-09: value_cents single source of truth)
- Revenue/gamepass/draw-count scans unchanged; response schema fully compatible
Co-Authored-By: claude-flow <ruv@ruv.net>
|
2026-03-21 18:38:33 +08:00 |
|
|
|
5b34972ee3
|
fix(dashboard): 盈亏分析CAST修复+视角改为平台视角(A-B)
1. CAST修复:
MySQL的 / 运算符返回DECIMAL类型,GORM无法将DECIMAL扫描进int64,
导致商品产出静默返回0。添加 CAST(... AS SIGNED) 与排行榜对齐。
2. 视角统一:
盈亏分析原为用户视角(B-A),排行榜为平台视角(A-B),同一用户
一个显示+¥12,130(用户赚了),一个显示-¥12,127(平台亏了),
造成管理员困惑。
修改:
- 净盈亏: Value-Cost → Cost-Value (A-B,平台盈利为正)
- 盈亏比: Value/Cost → Cost/Value (A/B,>1表示平台盈利)
- 趋势图每个数据点同步调整
|
2026-03-20 21:18:02 +08:00 |
|
|
|
fe3141e2b5
|
fix(dashboard): 盈亏分析商品产出对齐排行榜计算口径
问题:
盈亏分析(GetUserProfitLossTrend)和用户画像(GetUserProfile)中的
"商品产出"与玩家消费排行榜(DashboardPlayerSpendingLeaderboard)
计算口径不一致,导致同一用户的商品产出差异巨大。
排行榜显示用户9110商品产出¥16,913.40,盈亏分析显示¥0.00。
差异点:
1. status条件: 盈亏用 status=1(仅待发货),排行榜用 status IN (1,3)
2. 价格回退链: 盈亏缺少 price_snapshot_cents 回退层级
3. 道具卡倍率: 盈亏未计算 reward_multiplier_x1000
4. void排除: 盈亏未排除 remark 含 void 的作废项
修复:
- users_profit_loss.go: 商品产出查询完全对齐排行榜公式
- users_profile.go: 库存价值查询同步对齐
- 公式: COALESCE(value_cents, snapshot_cents, price, 0)
* GREATEST(COALESCE(multiplier, 1000), 1000) / 1000
- 条件: status IN (1,3) AND remark NOT LIKE '%void%'
|
2026-03-20 21:02:21 +08:00 |
|
|
|
ddd66bf4e9
|
fix(dashboard): 修复盈亏分析商品产出只统计待发货库存的bug
问题:
盈亏分析(GetUserProfitLossTrend)和用户画像(GetUserProfile)中的
"商品产出"查询条件为 `ui.status = 1`,只统计了待发货/库存中的商品,
已发货/已兑换(status=3)的商品被完全排除。
示例:用户9110实际累计获得874件商品(价值¥16,279.40),但因为大部分
已发货(status=3),盈亏分析只显示商品产出¥12.50,全资产产出严重偏低。
而 dashboard_user_spending.go 中的同类查询正确使用了
`status IN (1, 3)`,说明此处是遗漏。
修复:
- users_profit_loss.go: 当前资产快照查询改为 `status IN (1, 3)`
- users_profile.go: 库存统计查询改为 `status IN (1, 3)`
- 与 dashboard_user_spending.go 的计算口径对齐
|
2026-03-20 20:39:50 +08:00 |
|
|
|
9cb4aaa511
|
fix(admin): 修复订单列表source_type=4/5显示未知的问题
- source_type=4: 区分购买次卡/次卡抽奖/一番赏
- source_type=5: 区分运费订单/直播间抽奖
|
2026-03-20 17:45:19 +08:00 |
|
win
|
a671fc14c6
|
运费
|
2026-03-20 00:57:17 +08:00 |
|
win
|
eaf4af4ba4
|
Merge remote-tracking branch 'origin/zuncle'
|
2026-03-19 22:37:56 +08:00 |
|
|
|
47c36b43cd
|
feat(fragment): add synthesis flow and fragment restrictions with tests
|
2026-03-19 16:26:36 +08:00 |
|
|
|
4ffd8e8326
|
fix: 修复过期优惠券仍可兑换/使用的漏洞
- store.go: 积分商城优惠券列表加 valid_end > now 过滤
- coupons_list.go: 修复 NULL valid_end 被错误排除,无截止日期券正确显示为有效
- activity_order_service.go: 过期/不可用券下单返回明确错误,不再静默跳过
- points_redeem_coupon_app.go: 积分兑换前校验模板 valid_end
- coupon_add.go: 发券前校验模板 valid_end,过期拒绝发放
|
2026-03-18 21:58:25 +08:00 |
|
|
|
9f7a7d29fb
|
fix(admin): 管理端取消订单改为调用 userSvc.CancelOrder,补充优惠券和积分退还逻辑
|
2026-03-18 21:12:46 +08:00 |
|
|
|
0722e515c4
|
feat(shipping): 新增管理端撤销发货功能
- 新增 AdminCancelShipping handler,支持批量撤销待发货记录(status=1→5)
- 事务内同步恢复 user_inventory.status=1 并清空 shipping_no
- 在 remark 记录操作人 adminID,保证审计可追溯
- 注册路由 POST /api/admin/shipping/orders/cancel
|
2026-03-18 20:11:37 +08:00 |
|
|
|
d1ee319f0e
|
feat(dashboard): 平台有效资产增加优惠券和次卡价值统计
- 新增优惠券总价值统计(关联system_coupons表)
- 新增次卡总价值统计(关联activities表price_draw)
- 使用Raw SQL执行复杂JOIN查询
|
2026-03-17 19:17:56 +08:00 |
|
win
|
a450a92673
|
Merge origin/zuncle into main
|
2026-03-17 16:00:23 +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 |
|
|
|
fac825245b
|
fix: 修复赠送流程地址归属错误,强制登录后才能填写收货地址
接收者未登录时提交地址会错误保存到赠送者名下,现改为:
- API层:登录态从可选改为必选,未登录返回401
- Service层:始终用提交者ID作为地址归属人
|
2026-03-15 13:23:09 +08:00 |
|
|
|
2aa7cdbd61
|
fix(shipping): 使用资产价值快照价格确保发货与分解价格一致
修复改价后发货价格与分解价格不一致的问题:
- 发货时优先使用 user_inventory.value_cents 快照价格
- 后台发货列表使用 shipping_records.price 存储的快照价格
- 确保盈亏统计时价格数据准确一致
|
2026-03-05 17:54:58 +08:00 |
|
win
|
b3b63dcba2
|
admin
|
2026-03-05 12:50:06 +08:00 |
|
win
|
994a7ba0df
|
邀请关系
|
2026-02-27 17:51:38 +08:00 |
|
win
|
e0db8751f3
|
任务中心的问题
|
2026-02-27 16:07:12 +08:00 |
|
win
|
46a7253239
|
fix:订单同步
|
2026-02-27 00:08:02 +08:00 |
|
win
|
9972427cea
|
fix: treat livestream pass orders as ticket price
|
2026-02-24 10:02:11 +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 |
|
|
|
ec035ffb53
|
任务大厅,限量显示
|
2026-02-19 19:55:25 +08:00 |
|
|
|
af1c16c7c5
|
优惠券bug
|
2026-02-18 23:23:34 +08:00 |
|
|
|
58baa11a98
|
fix:优惠券购买次卡bug
|
2026-02-10 01:17:15 +08:00 |
|
|
|
e124f8d4ff
|
优化钱
|
2026-02-08 17:19:27 +08:00 |
|
|
|
fbdaf77eda
|
x
|
2026-02-06 16:49:27 +08:00 |
|
|
|
029ed489bc
|
x
|
2026-02-06 15:18:16 +08:00 |
|
|
|
571cb2f4db
|
add: 仪表盘
|
2026-02-04 12:44:37 +08:00 |
|
|
|
9eea272d69
|
统计更新
|
2026-02-03 17:44:02 +08:00 |
|
|
|
25c44c2064
|
x
|
2026-02-02 23:56:01 +08:00 |
|
|
|
55e22086e8
|
201
|
2026-02-01 00:27:38 +08:00 |
|
|
|
1a8f94d7b8
|
fix
|
2026-01-29 19:25:16 +08:00 |
|
|
|
ff404e21f0
|
x
|
2026-01-28 21:38:44 +08:00 |
|
|
|
021ab34c75
|
add:opencode
|
2026-01-28 21:36:36 +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 |
|
|
|
e3a96e68d8
|
fix: 修复退款时清理一番赏格位、积分兑换商品库存校验及抖音登录自邀问题。
|
2026-01-06 01:46:25 +08:00 |
|
|
|
359ca9121f
|
chore: 添加定时开奖和抖店同步的调试与信息日志
|
2026-01-04 22:58:38 +08:00 |
|
|
|
fb6dc1e434
|
feat: 新增抖音登录功能、管理端次数卡及套餐管理接口,并引入配置迁移工具。
|
2026-01-04 01:40:11 +08:00 |
|
|
|
e8bfff8261
|
feat: 新增抖音订单、游戏通行证、快照回滚、短信登录及管理后台功能,并优化支付、活动与用户服务模块,同时清理旧文档
|
2026-01-02 12:38:03 +08:00 |
|
|
|
4a582997d1
|
feat: 引入活动抽奖策略槽位选择功能,新增用户库存发货单号字段,并优化支付与活动服务集成。
|
2025-12-26 18:15:15 +08:00 |
|
|
|
8eb28465a2
|
feat: 新增用户地址更新功能并优化抽奖结果展示,支持显示订单所有抽奖记录
|
2025-12-26 12:44:29 +08:00 |
|
|
|
2838ccb4c7
|
feat: 商店商品展示新增所需积分,抽奖策略强制使用活动承诺种子,并新增用户过期任务和游戏令牌服务
|
2025-12-26 12:22:32 +08:00 |
|