feat: 拆分开奖与结算审核流程,新增手动结果录入、重开和派彩审批接口
This commit is contained in:
@@ -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 Pos2AbcSettlementMatcher implements SettlementPlayMatcher
|
||||
$bestTier = null;
|
||||
$bestRank = 99;
|
||||
|
||||
foreach ($combinations as $c) {
|
||||
/** @var TicketCombination $c */
|
||||
$n = (string) $c->number_4d;
|
||||
if (strlen($n) < 2) {
|
||||
$suf = substr((string) $item->normalized_number, -2);
|
||||
$hitTier = null;
|
||||
$rank = 99;
|
||||
foreach ($suffixByTier as $t => $sx) {
|
||||
if ($suf !== $sx) {
|
||||
continue;
|
||||
}
|
||||
$suf = substr($n, -2);
|
||||
$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,
|
||||
'suffix2' => $suf,
|
||||
'tier' => $hitTier,
|
||||
'bet_amount' => $bet,
|
||||
'odds_value' => $oddsVal,
|
||||
'payout' => $total,
|
||||
];
|
||||
$bestRank = $rank;
|
||||
$bestTier = $hitTier;
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -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,16 +35,16 @@ final class Pos2TierSettlementMatcher implements SettlementPlayMatcher
|
||||
$lines = [];
|
||||
$total = 0;
|
||||
|
||||
foreach ($combinations as $c) {
|
||||
/** @var TicketCombination $c */
|
||||
$n = (string) $c->number_4d;
|
||||
if (strlen($n) < 2 || substr($n, -2) !== $suffix) {
|
||||
continue;
|
||||
}
|
||||
$bet = (int) $c->bet_amount;
|
||||
$payout = (int) floor($bet * ($oddsVal / 10_000));
|
||||
$total += $payout;
|
||||
$lines[] = ['number_4d' => $n, 'suffix2' => $suffix, 'payout' => $payout];
|
||||
if (substr((string) $item->normalized_number, -2) === $suffix) {
|
||||
$bet = (int) $item->unit_bet_amount;
|
||||
$total = (int) floor($bet * ($oddsVal / 10_000));
|
||||
$lines[] = [
|
||||
'number' => $item->original_number,
|
||||
'suffix2' => $suffix,
|
||||
'bet_amount' => $bet,
|
||||
'odds_value' => $oddsVal,
|
||||
'payout' => $total,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
@@ -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 [
|
||||
|
||||
@@ -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,16 +35,16 @@ final class Pos3TierSettlementMatcher implements SettlementPlayMatcher
|
||||
$lines = [];
|
||||
$total = 0;
|
||||
|
||||
foreach ($combinations as $c) {
|
||||
/** @var TicketCombination $c */
|
||||
$n = (string) $c->number_4d;
|
||||
if (strlen($n) < 3 || substr($n, -3) !== $suffix) {
|
||||
continue;
|
||||
}
|
||||
$bet = (int) $c->bet_amount;
|
||||
$payout = (int) floor($bet * ($oddsVal / 10_000));
|
||||
$total += $payout;
|
||||
$lines[] = ['number_4d' => $n, 'suffix3' => $suffix, 'payout' => $payout];
|
||||
if (substr((string) $item->normalized_number, -3) === $suffix) {
|
||||
$bet = (int) $item->unit_bet_amount;
|
||||
$total = (int) floor($bet * ($oddsVal / 10_000));
|
||||
$lines[] = [
|
||||
'number' => $item->original_number,
|
||||
'suffix3' => $suffix,
|
||||
'bet_amount' => $bet,
|
||||
'odds_value' => $oddsVal,
|
||||
'payout' => $total,
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user