feat: 拆分开奖与结算审核流程,新增手动结果录入、重开和派彩审批接口

This commit is contained in:
2026-05-16 18:01:06 +08:00
parent 83046b402d
commit 4f143c7cb1
38 changed files with 1992 additions and 170 deletions

View File

@@ -3,7 +3,6 @@
namespace App\Services\Settlement\Matchers;
use App\Models\TicketItem;
use App\Models\TicketCombination;
use Illuminate\Support\Collection;
use App\Services\Settlement\OddsSnapshotReader;
use App\Services\Settlement\PublishedDrawResultBoard;
@@ -36,42 +35,39 @@ final class Pos3AbcSettlementMatcher implements SettlementPlayMatcher
$bestTier = null;
$bestRank = 99;
foreach ($combinations as $c) {
/** @var TicketCombination $c */
$n = (string) $c->number_4d;
if (strlen($n) < 3) {
$suf = substr((string) $item->normalized_number, -3);
$hitTier = null;
$rank = 99;
foreach ($suffixByTier as $t => $sx) {
if ($suf !== $sx) {
continue;
}
$suf = substr($n, -3);
$hitTier = null;
$rank = 99;
foreach ($suffixByTier as $t => $sx) {
if ($suf !== $sx) {
continue;
}
$r = match ($t) {
'first' => 0,
'second' => 1,
'third' => 2,
default => 99,
};
if ($r < $rank) {
$rank = $r;
$hitTier = $t;
}
}
if ($hitTier === null) {
continue;
$r = match ($t) {
'first' => 0,
'second' => 1,
'third' => 2,
default => 99,
};
if ($r < $rank) {
$rank = $r;
$hitTier = $t;
}
}
if ($hitTier !== null) {
$oddsVal = $this->odds->oddsValueForScope($snapshot, $hitTier);
$bet = (int) $c->bet_amount;
$payout = (int) floor($bet * ($oddsVal / 10_000));
$total += $payout;
$lines[] = ['number_4d' => $n, 'tier' => $hitTier, 'payout' => $payout];
if ($rank < $bestRank) {
$bestRank = $rank;
$bestTier = $hitTier;
}
$bet = (int) $item->unit_bet_amount;
$total = (int) floor($bet * ($oddsVal / 10_000));
$lines[] = [
'number' => $item->original_number,
'suffix3' => $suf,
'tier' => $hitTier,
'bet_amount' => $bet,
'odds_value' => $oddsVal,
'payout' => $total,
];
$bestRank = $rank;
$bestTier = $hitTier;
}
return [