Refine horse race pool and quick entry
This commit is contained in:
@@ -50,6 +50,7 @@ class OpenHorseRaceJob implements ShouldQueue
|
||||
$horseCount = (int) ($config['horse_count'] ?? 4);
|
||||
$minBet = (int) ($config['min_bet'] ?? 100);
|
||||
$maxBet = (int) ($config['max_bet'] ?? 100000);
|
||||
$seedPool = (int) ($config['seed_pool'] ?? 0);
|
||||
|
||||
$now = now();
|
||||
$closesAt = $now->copy()->addSeconds($betSeconds);
|
||||
@@ -63,6 +64,7 @@ class OpenHorseRaceJob implements ShouldQueue
|
||||
'bet_opens_at' => $now,
|
||||
'bet_closes_at' => $closesAt,
|
||||
'horses' => $horses,
|
||||
'total_pool' => $seedPool,
|
||||
]);
|
||||
|
||||
// 广播开赛事件
|
||||
|
||||
@@ -70,12 +70,16 @@ class RunHorseRaceJob implements ShouldQueue
|
||||
fn ($h) => "{$h['emoji']}{$h['name']}",
|
||||
$race->horses ?? []
|
||||
));
|
||||
$quickOpenButton = '<button type="button" '
|
||||
.'onclick="event.preventDefault(); Alpine.$data(document.getElementById(\'horse-race-panel\')).openFromHall();" '
|
||||
.'style="margin-left:8px; padding:2px 8px; border:1px solid #d97706; border-radius:999px; background:#fff7ed; color:#b45309; font-size:12px; font-weight:bold; cursor:pointer;">'
|
||||
.'快速参与赌马</button>';
|
||||
$startMsg = [
|
||||
'id' => $chatState->nextMessageId(1),
|
||||
'room_id' => 1,
|
||||
'from_user' => '系统传音',
|
||||
'to_user' => '大家',
|
||||
'content' => "🏇 【赛马】第 #{$race->id} 场押注截止!马匹已进入跑道,比赛开始!参赛阵容:{$horseList}",
|
||||
'content' => "🏇 【赛马】第 #{$race->id} 场押注截止!马匹已进入跑道,比赛开始!参赛阵容:{$horseList}{$quickOpenButton}",
|
||||
'is_secret' => false,
|
||||
'font_color' => '#336699',
|
||||
'action' => '大声宣告',
|
||||
@@ -87,6 +91,7 @@ class RunHorseRaceJob implements ShouldQueue
|
||||
|
||||
$config = GameConfig::forGame('horse_racing')?->params ?? [];
|
||||
$raceDuration = (int) ($config['race_duration'] ?? 30);
|
||||
$seedPool = (int) ($config['seed_pool'] ?? 0);
|
||||
$horses = $race->horses ?? [];
|
||||
$horseCount = count($horses);
|
||||
|
||||
@@ -147,7 +152,7 @@ class RunHorseRaceJob implements ShouldQueue
|
||||
|
||||
// 计算注池统计
|
||||
$totalBets = HorseBet::query()->where('race_id', $race->id)->count();
|
||||
$totalPool = HorseBet::query()->where('race_id', $race->id)->sum('amount');
|
||||
$totalPool = $seedPool + HorseBet::query()->where('race_id', $race->id)->sum('amount');
|
||||
|
||||
$race->update([
|
||||
'total_bets' => $totalBets,
|
||||
|
||||
Reference in New Issue
Block a user