fix: 增强配置发布校验与关闭玩法清理提示
1. 发布赔率、玩法配置和风控封顶草稿前校验空配置、重复项、金额范围和合法性 2. 限制赔率返水与佣金比例在 0 到 1 之间 3. 投注预览和下单遇到已关闭玩法时返回需清理注项明细
This commit is contained in:
@@ -65,9 +65,22 @@ final class TicketPlacementService
|
||||
$totalRebate = 0;
|
||||
$totalActualDeduct = 0;
|
||||
$totalEstimatedPayout = 0;
|
||||
$closedPlayCleanupRows = [];
|
||||
|
||||
foreach ((array) $payload['lines'] as $line) {
|
||||
$resolved = $this->catalogResolver->resolve((string) $line['play_code'], $currencyCode);
|
||||
foreach ((array) $payload['lines'] as $index => $line) {
|
||||
try {
|
||||
$resolved = $this->catalogResolver->resolve((string) $line['play_code'], $currencyCode);
|
||||
} catch (TicketOperationException $e) {
|
||||
if ($e->lotteryCode === ErrorCode::PlayModeClosed->value) {
|
||||
$closedPlayCleanupRows[] = [
|
||||
'client_line_no' => $index + 1,
|
||||
'play_code' => (string) ($line['play_code'] ?? ''),
|
||||
];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
$evaluated = $this->ruleEngine->evaluateLine(
|
||||
(array) $line,
|
||||
$resolved['play_type'],
|
||||
@@ -89,6 +102,18 @@ final class TicketPlacementService
|
||||
$totalEstimatedPayout += (int) $evaluated['estimated_max_payout'];
|
||||
}
|
||||
|
||||
if ($closedPlayCleanupRows !== []) {
|
||||
throw new TicketOperationException(
|
||||
'play_closed_need_cleanup',
|
||||
ErrorCode::PlayModeClosed->value,
|
||||
400,
|
||||
[
|
||||
'cleanup_hint' => '玩法已关闭,相关注项已清理',
|
||||
'cleanup_lines' => $closedPlayCleanupRows,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
$order = TicketOrder::query()->create([
|
||||
'order_no' => $this->newOrderNo(),
|
||||
'player_id' => $player->id,
|
||||
|
||||
@@ -36,9 +36,22 @@ final class TicketPreviewService
|
||||
$totalActualDeduct = 0;
|
||||
$totalEstimatedPayout = 0;
|
||||
$warningRows = [];
|
||||
$closedPlayCleanupRows = [];
|
||||
|
||||
foreach ((array) $payload['lines'] as $index => $line) {
|
||||
$resolved = $this->catalogResolver->resolve((string) $line['play_code'], $currencyCode);
|
||||
try {
|
||||
$resolved = $this->catalogResolver->resolve((string) $line['play_code'], $currencyCode);
|
||||
} catch (TicketOperationException $e) {
|
||||
if ($e->lotteryCode === ErrorCode::PlayModeClosed->value) {
|
||||
$closedPlayCleanupRows[] = [
|
||||
'client_line_no' => $index + 1,
|
||||
'play_code' => (string) ($line['play_code'] ?? ''),
|
||||
];
|
||||
continue;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
$evaluated = $this->ruleEngine->evaluateLine(
|
||||
(array) $line,
|
||||
$resolved['play_type'],
|
||||
@@ -83,6 +96,18 @@ final class TicketPreviewService
|
||||
];
|
||||
}
|
||||
|
||||
if ($closedPlayCleanupRows !== []) {
|
||||
throw new TicketOperationException(
|
||||
'play_closed_need_cleanup',
|
||||
ErrorCode::PlayModeClosed->value,
|
||||
400,
|
||||
[
|
||||
'cleanup_hint' => '玩法已关闭,相关注项已清理',
|
||||
'cleanup_lines' => $closedPlayCleanupRows,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return [
|
||||
'draw' => [
|
||||
'draw_id' => $draw->draw_no,
|
||||
|
||||
Reference in New Issue
Block a user