feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池
This commit is contained in:
26
app/Services/Settlement/OddsSnapshotReader.php
Normal file
26
app/Services/Settlement/OddsSnapshotReader.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Settlement;
|
||||
|
||||
/**
|
||||
* 从注单赔率快照 JSON 读取各档赔率(阶段 5 落库结构,与 {@see PlayRuleEngine} 一致)。
|
||||
*/
|
||||
final class OddsSnapshotReader
|
||||
{
|
||||
/**
|
||||
* @param list<array<string, mixed>>|null $snapshot
|
||||
*/
|
||||
public function oddsValueForScope(?array $snapshot, string $scope): int
|
||||
{
|
||||
if ($snapshot === null) {
|
||||
return 0;
|
||||
}
|
||||
foreach ($snapshot as $row) {
|
||||
if (($row['prize_scope'] ?? null) === $scope) {
|
||||
return (int) ($row['odds_value'] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user