1.优化websocket接口,新增赔率参数

This commit is contained in:
2026-05-15 16:24:19 +08:00
parent 575aa279bd
commit 91229f4477
13 changed files with 434 additions and 40 deletions

View File

@@ -107,22 +107,23 @@ final class StreakWinReward
}
/**
* lobbyInit 用:连胜赔率档位(与后台「连胜奖励」、派彩公式一致)
* 当前玩家本局适用赔率(非全表):按 current_streak 解析下一注中奖将使用的档位
*
* @return array{rows: list<array{streak: int, odds_factor: int, is_jackpot: bool}>}
* @return array{current_streak: int, streak_level: int, odds_factor: int, is_jackpot: bool}
*/
public static function lobbyPayload(): array
public static function playerBetOddsForCurrentStreak(int $currentStreak): array
{
$rows = [];
foreach (self::loadRows() as $row) {
$rows[] = [
'streak' => (int) ($row['streak'] ?? 0),
'odds_factor' => (int) ($row['odds_factor'] ?? 0),
'is_jackpot' => ($row['is_jackpot'] ?? false) === true,
];
if ($currentStreak < 0) {
$currentStreak = 0;
}
$row = self::rowForStreakAtBet($currentStreak);
return ['rows' => $rows];
return [
'current_streak' => $currentStreak,
'streak_level' => self::levelFromStreakAtBet($currentStreak),
'odds_factor' => (int) ($row['odds_factor'] ?? 1),
'is_jackpot' => ($row['is_jackpot'] ?? false) === true,
];
}
/**