where('status', ConfigVersionStatus::Active->value)->exists()) { return; } DB::transaction(function (): void { $playVersion = PlayConfigVersion::query()->create([ 'version_no' => 1, 'status' => ConfigVersionStatus::Active->value, 'effective_at' => now(), 'updated_by' => null, 'reason' => 'seed:v1', ]); foreach (PlayType::query()->orderBy('sort_order')->orderBy('play_code')->get() as $pt) { PlayConfigItem::query()->create([ 'version_id' => $playVersion->id, 'play_code' => $pt->play_code, 'is_enabled' => (bool) $pt->is_enabled, 'min_bet_amount' => 100, 'max_bet_amount' => 500_000_000, 'display_order' => (int) $pt->sort_order, 'rule_text_zh' => null, 'rule_text_en' => null, 'rule_text_ne' => null, 'extra_config_json' => null, ]); } $oddsVersion = OddsVersion::query()->create([ 'version_no' => 1, 'status' => ConfigVersionStatus::Active->value, 'effective_at' => now(), 'updated_by' => null, 'reason' => 'seed:v1', ]); /** 对齐界面文档 §5.5:头/二/三/特别/安慰;odds_value = 乘数×10000(NPR 基准展示口径) */ foreach (PlayType::query()->orderBy('sort_order')->orderBy('play_code')->get() as $pt) { foreach (OddsStandardScopes::PRESET_ODDS_BY_SCOPE as $scope => $oddsValue) { OddsItem::query()->create([ 'version_id' => $oddsVersion->id, 'play_code' => $pt->play_code, 'prize_scope' => $scope, 'odds_value' => $oddsValue, 'rebate_rate' => 0, 'commission_rate' => 0, 'currency_code' => 'NPR', 'extra_config_json' => null, ]); } } $riskVersion = RiskCapVersion::query()->create([ 'version_no' => 1, 'status' => ConfigVersionStatus::Active->value, 'effective_at' => now(), 'updated_by' => null, 'reason' => 'seed:v1', ]); foreach (['0000', '1234', '9999'] as $num) { RiskCapItem::query()->create([ 'version_id' => $riskVersion->id, 'draw_id' => null, 'normalized_number' => $num, 'cap_amount' => 50_000_000_000, 'cap_type' => 'per_number', ]); } }); } }