feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池

This commit is contained in:
2026-05-11 15:34:34 +08:00
parent 6a55fa9592
commit 19003f5041
50 changed files with 3604 additions and 3 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Services\Settlement;
use App\Services\Settlement\Contracts\SettlementPlayMatcher;
use App\Services\Settlement\Matchers\BigSpreadSettlementMatcher;
use App\Services\Settlement\Matchers\FirstPrizeComboSettlementMatcher;
use App\Services\Settlement\Matchers\NoopSettlementMatcher;
use App\Services\Settlement\Matchers\Pos2AbcSettlementMatcher;
use App\Services\Settlement\Matchers\Pos2TierSettlementMatcher;
use App\Services\Settlement\Matchers\Pos3AbcSettlementMatcher;
use App\Services\Settlement\Matchers\Pos3TierSettlementMatcher;
use App\Services\Settlement\Matchers\Pos4ExactTierSettlementMatcher;
use App\Services\Settlement\Matchers\Pos4ListTierSettlementMatcher;
use App\Services\Settlement\Matchers\SmallSpreadSettlementMatcher;
use App\Services\Settlement\Matchers\StraightLikeSettlementMatcher;
final class SettlementMatcherRegistry
{
public function __construct(
private readonly StraightLikeSettlementMatcher $straight,
private readonly BigSpreadSettlementMatcher $big,
private readonly SmallSpreadSettlementMatcher $small,
private readonly Pos4ExactTierSettlementMatcher $pos4Exact,
private readonly Pos4ListTierSettlementMatcher $pos4List,
private readonly Pos3TierSettlementMatcher $pos3Tier,
private readonly Pos3AbcSettlementMatcher $pos3Abc,
private readonly Pos2TierSettlementMatcher $pos2Tier,
private readonly Pos2AbcSettlementMatcher $pos2Abc,
private readonly FirstPrizeComboSettlementMatcher $firstPrizeCombo,
private readonly NoopSettlementMatcher $noop,
) {}
public function for(string $playCode): SettlementPlayMatcher
{
// half_boxPRD 一期预留;结算按已落库组合逐条取 23 档最优档,与 big/box 家族一致§5.6.6)。
return match ($playCode) {
'straight', 'roll' => $this->straight,
'big', 'ibox', 'mbox', 'box', 'half_box' => $this->big,
'small' => $this->small,
'pos_4a', 'pos_4b', 'pos_4c' => $this->pos4Exact,
'pos_4d', 'pos_4e' => $this->pos4List,
'pos_3a', 'pos_3b', 'pos_3c' => $this->pos3Tier,
'pos_3abc' => $this->pos3Abc,
'pos_2a', 'pos_2b', 'pos_2c' => $this->pos2Tier,
'pos_2abc' => $this->pos2Abc,
'head', 'tail', 'odd', 'even', 'digit_big', 'digit_small' => $this->firstPrizeCombo,
default => $this->noop,
};
}
}