fix(ticket): 修正 full_play/half_play/reverse 投注模式的金额计算逻辑
Some checks failed
lotterLaravel CI / test (push) Has been cancelled
lotterLaravel E2E / e2e-api (push) Has been cancelled

统一通过 $amountModePlayCode 映射选择类型到正确的金额模式:
- reverse / half_play / full_play 使用 ibox 模式(单注 × 组合数)
- full_cover 使用 mbox 模式(总金额平摊)
- straight 保持原有 play_code 规则
This commit is contained in:
2026-07-15 12:02:10 +08:00
parent cbb18b976f
commit cec2fd7c4f
2 changed files with 115 additions and 2 deletions

View File

@@ -59,8 +59,17 @@ final class PlayRuleEngine
throw new TicketOperationException('full_cover_amount_not_divisible', ErrorCode::BetInvalidPlayInput->value);
}
$unitBetAmount = $this->resolveUnitBetAmount($selectionType === 'full_cover' ? 'mbox' : $playCode, $amount, $combinationCount);
$totalBetAmount = $this->resolveTotalBetAmount($selectionType === 'full_cover' ? 'mbox' : $playCode, $amount, $unitBetAmount, $combinationCount);
// 种类金额模式:
// - full_cover全保→ 总金额平摊mbox
// - reverse / half_play / full_play → 单注 × 组合数ibox
// - straight → 沿用 play_code 自身规则
$amountModePlayCode = match ($selectionType) {
'full_cover' => 'mbox',
'full_play', 'reverse', 'half_play' => 'ibox',
default => $playCode,
};
$unitBetAmount = $this->resolveUnitBetAmount($amountModePlayCode, $amount, $combinationCount);
$totalBetAmount = $this->resolveTotalBetAmount($amountModePlayCode, $amount, $unitBetAmount, $combinationCount);
$dimensionInt = $this->toDimensionInt(is_string($dimension) ? $dimension : null, $playConfig);
$primaryOdds = $this->pickPrimaryOdds($oddsItems);
$rebateRate = (float) $primaryOdds->rebate_rate;