修复跑马 不能正常显示赢后的奖励金额
This commit is contained in:
@@ -80,6 +80,15 @@ class HorseRaceController extends Controller
|
||||
];
|
||||
}, $horses);
|
||||
|
||||
// 押注阶段实时总池 = 当前记录的基础池(通常为种子池)+ 实时下注总额;
|
||||
// 跑马/结算阶段 total_pool 已写回最终值,不能再重复叠加下注额。
|
||||
$basePool = $race->status === 'betting'
|
||||
? max((int) $race->total_pool, $seedPool)
|
||||
: (int) $race->total_pool;
|
||||
$displayTotalPool = $race->status === 'betting'
|
||||
? $basePool + array_sum(array_values($horsePools))
|
||||
: $basePool;
|
||||
|
||||
return response()->json([
|
||||
'race' => [
|
||||
'id' => $race->id,
|
||||
@@ -89,7 +98,7 @@ class HorseRaceController extends Controller
|
||||
? max(0, (int) now()->diffInSeconds($race->bet_closes_at, false))
|
||||
: 0,
|
||||
'horses' => $horsesWithBets,
|
||||
'total_pool' => $race->total_pool + array_sum(array_values($horsePools)),
|
||||
'total_pool' => $displayTotalPool,
|
||||
'my_bet' => $myBet ? [
|
||||
'horse_id' => $myBet->horse_id,
|
||||
'amount' => $myBet->amount,
|
||||
|
||||
Reference in New Issue
Block a user