1.优化接口/api/game/lobbyInit,新增赔率参数
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\library\game\BetChips;
|
||||
use app\common\library\game\StreakWinReward;
|
||||
use app\common\library\game\ZiHuaDictionary;
|
||||
use app\common\model\BetOrder;
|
||||
use app\common\model\GameRecord;
|
||||
@@ -67,6 +68,7 @@ class Game extends MobileBase
|
||||
BetChips::lobbyChipsPayload()
|
||||
),
|
||||
'dictionary' => $items,
|
||||
'streak_win_reward' => StreakWinReward::lobbyPayload(),
|
||||
'user_snapshot' => [
|
||||
'coin' => $user->coin,
|
||||
'current_streak' => $user->current_streak ?? 0,
|
||||
|
||||
@@ -106,6 +106,25 @@ final class StreakWinReward
|
||||
return self::$cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* lobbyInit 用:连胜赔率档位(与后台「连胜奖励」、派彩公式一致)。
|
||||
*
|
||||
* @return array{rows: list<array{streak: int, odds_factor: int, is_jackpot: bool}>}
|
||||
*/
|
||||
public static function lobbyPayload(): 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,
|
||||
];
|
||||
}
|
||||
|
||||
return ['rows' => $rows];
|
||||
}
|
||||
|
||||
/**
|
||||
* streak_at_bet 为下注时快照(0 表示尚未连胜);档位取 min(streak_at_bet+1, 10)。
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user