feat: 扩展玩法配置快照字段并切换目录生效来源
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Services\Ticket;
|
||||
|
||||
use App\Models\OddsItem;
|
||||
use App\Models\PlayType;
|
||||
use App\Lottery\ErrorCode;
|
||||
use App\Models\PlayConfigItem;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -20,7 +19,7 @@ final class PlayRuleEngine
|
||||
* @param Collection<int, OddsItem> $oddsItems
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function evaluateLine(array $line, PlayType $playType, PlayConfigItem $playConfig, Collection $oddsItems): array
|
||||
public function evaluateLine(array $line, PlayConfigItem $playConfig, Collection $oddsItems): array
|
||||
{
|
||||
$playCode = (string) $line['play_code'];
|
||||
$dimension = $line['dimension'] ?? null;
|
||||
@@ -61,9 +60,9 @@ final class PlayRuleEngine
|
||||
'original_number' => (string) $line['number'],
|
||||
'normalized_number' => $number,
|
||||
'play_code' => $playCode,
|
||||
'dimension' => $this->toDimensionInt(is_string($dimension) ? $dimension : null, $playType),
|
||||
'dimension' => $this->toDimensionInt(is_string($dimension) ? $dimension : null, $playConfig),
|
||||
'digit_slot' => $digitSlotInt,
|
||||
'bet_mode' => $playType->bet_mode,
|
||||
'bet_mode' => $playConfig->bet_mode,
|
||||
'unit_bet_amount' => $unitBetAmount,
|
||||
'total_bet_amount' => $totalBetAmount,
|
||||
'rebate_rate_snapshot' => number_format($rebateRate, 4, '.', ''),
|
||||
@@ -300,13 +299,13 @@ final class PlayRuleEngine
|
||||
return $oddsItems->firstOrFail();
|
||||
}
|
||||
|
||||
private function toDimensionInt(?string $dimension, PlayType $playType): ?int
|
||||
private function toDimensionInt(?string $dimension, PlayConfigItem $playConfig): ?int
|
||||
{
|
||||
return match ($dimension) {
|
||||
'D2' => 2,
|
||||
'D3' => 3,
|
||||
'D4' => 4,
|
||||
default => $playType->dimension === null ? null : (int) $playType->dimension,
|
||||
default => $playConfig->dimension === null ? null : (int) $playConfig->dimension,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user