Files
cursor/plans/定格列表盈利阈值_5a7a1ed2.plan.md
ray zhou f71a5c59af ok
2026-05-29 11:21:40 +08:00

5.2 KiB
Raw Blame History

name, overview, todos, isProject
name overview todos isProject
定格列表盈利阈值 在管理后台首充定格统计列表中,按当前页 UID 调用与 game/pop/index 相同的养客配置接口PopService → slot_pwa getDPByPlayers为每行补充 profitthreshold及可选 hasprofitthreshold字段前端新增对应列。
id content status
pop-service-batch PopService 新增 mapDevelopPlayerByUids按 uid 调用 getPageList 并容错 completed
id content status
logic-enrich FreeCreditsStatsLogic.list 合并 profitthreshold及可选 hasprofitthreshold completed
id content status
vue-columns freeCreditsStats/index.vue 增加盈利阈值列与展示格式化 completed
id content status
verify-pop-parity 抽 12 个 UID 对比养客配置页与定格列表字段一致 completed
false

首充定格列表增加盈利阈值

背景

  • 首充定格统计已迁入 slot_admin,接口 GET /game/freeCreditsStats/index 返回列表 + 顶部汇总。
  • 养客配置页 game/pop/index 通过 PopController::indexPopService::getPageListslot_pwa pop/admin/getDPByPlayers → 游戏侧 /api/v2/dp/getDPByPlayers,列表含 profitthresholdhasprofitthreshold 等字段。
  • 需求文档 §18.2 未写盈利阈值,属运营侧补充字段;数据源应与养客页一致,不用 UserTag.popBalance 等本地 tag。

数据流

flowchart LR
  vue[freeCreditsStats/index.vue] --> api["/game/freeCreditsStats/index"]
  api --> logic[FreeCreditsStatsLogic.list]
  logic --> db[(s_common free_credits_*)]
  logic --> wallet[WalletService statistic]
  logic --> pop[PopService getPageList]
  pop --> pwa[slot_pwa getDPByPlayers]
  pwa --> game["/api/v2/dp/getDPByPlayers"]

实现要点

1. PopService按 UID 批量取养客配置(公共封装)

PopService.php 新增方法,例如 mapDevelopPlayerByUids(array $uids): array<int, array>

  • 对每个 uid 调用现有 getPageList(['userid' => $uid, 'page' => 1, 'limit' => 1])(与 pop/index 单用户筛选一致;starttime/endtime 不传,与养客页默认「全量」查询一致)。
  • 从返回 data[0] 取行;无记录或接口异常时该 uid 映射为 nullLogic 展示 - / 空)。
  • 单 uid 失败只 logger()->warning拖垮整页列表(与 fetchTotalRecharge 容错一致)。

说明getDPByPlayers 仅支持单 userid,每页最多 100 条 ≈ 最多 100 次 HTTP经 pwa 到游戏 API。当前 limit 上限 100可接受若后续性能不足再与游戏侧协商批量接口不在本次范围。

2. FreeCreditsStatsLogic列表富化

FreeCreditsStatsLogic::list 中,在已有 fetchTotalRecharge 之后:

  • 调用 PopService 批量映射;
  • 为每行写入(字段名与 pop/index 保持一致,便于前端复用展示逻辑):
    • profitthresholdint|null,配置值(养客页原样展示,除 10000
    • 若产品确认需要第二列:hasprofitthreshold,游戏侧为千分位类整数,展示时与养客页 toNum 一致:Number((val / 10000).toFixed(2))

无养客配置的用户:profitthresholdnull,前端显示 -

分层:跨服务 HTTP 封装在 PopServiceFreeCreditsStatsLogic 只编排,不直接拼 pwaApiHost URL。

3. 前端:新增列

修改 freeCreditsStats/index.vue

  • 在「累计充值金额」后(或渠道后)增加列:
    • 盈利阈值profitthreshold
    • (若选两列)已达盈利阈值hasprofitthresholdslot 内 /10000 格式化
  • 无自定义 slot 时直接显示;null/undefined 显示 -

路由、API 文件 freeCreditsStats.js 不变

4. 不改动的部分

  • statistics 顶部 7 项汇总不加盈利阈值(无聚合口径)。
  • Validate / DTO 无新筛选项。
  • slot_console innerapi、slot_sdk 无需改动(统计已在 admin

验证

  • 某 UID 在「养客配置」页能查到 profitthreshold 时,定格列表同 UID 显示相同值。
  • 无养客配置 UID 显示 -,列表其余字段正常。
  • pop/pwa 不可用时:列表仍可出数,盈利阈值为空;日志有 warning。
  • 与迁前对比:除新增列外,筛选、排序、汇总、累计充值口径不变。

涉及文件

仓库 文件
slot_admin PopService.phpFreeCreditsStatsLogic.php
slot_admin_vue freeCreditsStats/index.vue