Files
cursor/plans/daily-rebate-info调整_9c1cb5e8.plan.md
ray zhou f71a5c59af ok
2026-05-29 11:21:40 +08:00

37 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: daily-rebate-info调整
overview: 恢复 `info``tiers` 输出,并明确继续使用共享 Redis 实时计算当天返水,补齐稳定性与返回一致性。
todos:
- id: restore-tiers
content: 在 DailyRebateLogic::info 恢复 tiers 返回并保持现有档位格式
status: completed
- id: harden-today-redis
content: 加固 readTodayBetFromRedis 容错,确保实时计算稳定
status: completed
- id: verify-info-contract
content: 核对 info 字段契约并运行 verify-slot-backend 脚本
status: completed
isProject: false
---
# DailyRebate Info 返回修正计划
## 目标
-`DailyRebate info` 中恢复 `tiers` 字段。
- 当天数据继续采用“共享 Redis 读取下注 + 本地按档位计算返水”的方案。
- 保持近 7 天固定返回与展示金额口径不变。
## 变更点
- 更新 [`/Users/ray/Documents/project/www/slot/slot_console/app/api/logic/DailyRebateLogic.php`](/Users/ray/Documents/project/www/slot/slot_console/app/api/logic/DailyRebateLogic.php)
-`info()` 返回结构中重新加入 `tiers`(复用现有档位格式化逻辑)。
- 保持 `records` 固定 7 天(无数据补 0 展示金额)。
- 明确当天逻辑:从 `readTodayBetFromRedis()` 读取共享 Redis 的当日下注,调用 `DailyRebateCalcService::calcRebateLi()` 计算当日 `rebate_display`
- 为 Redis 空值/脏值场景补轻量容错(反序列化失败时按 0 处理,避免接口抖动)。
- 只读一致性确认(不改跨服务架构)
- 依据 [`/Users/ray/Documents/project/www/slot/slot_pwa/app/service/user/UserProfitService.php`](/Users/ray/Documents/project/www/slot/slot_pwa/app/service/user/UserProfitService.php) 与 [`/Users/ray/Documents/project/www/slot/slot_pwa/app/service/RedisKeyManagerService.php`](/Users/ray/Documents/project/www/slot/slot_pwa/app/service/RedisKeyManagerService.php),继续对齐 `Redis::connection('share') + getUserProfitKey(date('Ymd'))` 键模型。
## 验证
- 检查 `info` 返回字段:包含 `tiers``title/subtitle/help``records(7条)``claimable`
- 抽样验证当天记录:有 Redis 下注时 `rebate_display` 非 0无下注时为 0。
- 执行门禁脚本:`~/.cursor/hooks/verify-slot-backend.sh`