Files
dafuweng-saiadmin6.x/server/docs/PLAY_START_FLOW_COMPARISON.md
2026-03-16 09:10:39 +08:00

50 lines
4.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.
# 抽奖流程对比:当前实现 vs 预期流程
## 你描述的预期流程
1. **先判断中的是 T1T5 中的哪个奖**
→ 按彩金池/玩家权重抽档位 T1T5。
2. **根据 (1) 中奖类型从 DiceRewardConfig 读取数据,再根据权重 weight 抽取点数 grid_number**
→ 该档位下多条配置,按每条配置的 **weight** 抽一条,得到这条配置的 **grid_number**(以及 real_ev 等)。
3. **根据抽取的 grid_number 查找有无对应的 s_end_indexn_end_index**
→ 用上一步得到的 grid_number及方向去查「带该 grid_number 且带 s_end_index/n_end_index 的配置」是否存在。
4. **若有则输出 s_end_indexn_end_index对应的点数和起始点数中奖数据仍用步骤 2 抽到的 grid_number 对应配置**
→ 输出起始点、终点s_end_index 或 n_end_index、点数和 roll_number中奖金额等用步骤 2 抽到的那条配置。
5. **判断是否中大奖**
→ 若点数和为豹子组合 (5,10,15,20,25,30),其中 5 和 30 必中大奖,其余按 BIGWIN 的 weight 再判一次;中大奖则返回 BIGWIN 的 roll_array。
---
## 当前实现
| 步骤 | 预期 | 当前实现 | 是否一致 |
|------|------|----------|----------|
| 1 | 先抽 T1T5 档位 | 按彩金池/玩家权重抽 T1T5 | ✅ 一致 |
| 2 | 按该档位配置的 **weight** 抽取 **grid_number**(即抽一条配置) | 该档位配置**等权随机**选一条 `chosen`**没有用 weight**;且当前用的 **grid_number 来自后面的「路径」配置**,不是来自这条 chosen | ❌ 不一致:未按 weight 抽grid_number 来源也不对 |
| 3 | 根据 grid_number 查 s_end_index / n_end_index | 根据 **chosen.id** 查「s_end_index = chosen.id 或 n_end_index = chosen.id」的配置得到若干 **startCandidates**(路径列表) | ❌ 不一致:是按「终点 id」查路径不是按 grid_number 查 |
| 4 | 若有则输出终点、点数和、起始点;中奖数据用步骤 2 的配置 | 从 startCandidates 里再**等权随机**一条 `startRecord`,用 **startRecord.id** 作起始、**startRecord.grid_number** 作点数和、**startRecord.s_end_index/n_end_index** 作终点中奖数据real_ev 等)用的是 **chosen** | ⚠️ 部分一致:终点、起始、点数和都有,但 grid_number 来自路径而不是「按 weight 抽出的那条配置」 |
| 5 | 豹子点数 5,10,15,20,25,305/30 必中大奖;其余按 BIGWIN.weight 判 | 逻辑一致5/30 必中大奖,其余用 BIGWIN 的 weight 判定 | ✅ 一致 |
### weight 是否实例化(入缓存)
- **BIGWIN**:缓存里有完整行,含 **weight**`getCachedByTierAndGridNumber('BIGWIN', rollNumber)` 返回的配置里带 weight已用于步骤 5。✅ 已实例化。
- **T1T5**`getCachedByTier(tier)` 返回的每条配置也是完整行(含 weight但当前代码**没有用这些 weight**,只用 `array_rand` 等权选一条。即weight 已在缓存里,但**未参与抽奖**。⚠️ 已实例化但未使用。
---
## 结论与建议
- **不一致点**
- 步骤 2应用「该档位下按 **weight** 抽一条配置」,用这条配置的 **grid_number**(和 real_ev 等);当前是等权抽一条且 grid_number 实际来自路径。
- 步骤 3应用「用步骤 2 得到的 **grid_number**(及方向)查是否有 s_end_index/n_end_index」当前是用 chosen.id 查「以该 id 为终点的路径」。
- **建议**
- 改为「先按档位内 weight 抽一条配置」,以该条为**唯一**来源得到 grid_number、real_ev、以及 s_end_index/n_end_index若表结构是一条配置同时带 grid_number 与 s_end_index/n_end_index
- 若表结构是「奖励配置」与「路径配置」分离,则需在步骤 2 按 weight 抽到 grid_number 后,再按 **grid_number + 方向** 查路径表得到 s_end_index/n_end_index 与起始点;并保证只对「在该方向下有有效 s_end_index/n_end_index 的配置」做 weight 抽取。
若你确认表结构(是否同一张表、是否一条既有 grid_number 又有 s_end_index/n_end_index我可以按上述思路给出具体修改方案含要改的类/方法名和伪代码)。