feat: 更新玩法配置管理,简化字段并增强功能

- 将玩法相关的显示名称字段统一为 `display_name`,移除多语言字段。
- 在 `PlayTypePatchController` 中新增即时切换玩法开关的功能,并推送大厅更新。
- 优化多个控制器和服务中的权限检查与数据处理逻辑,提升代码可读性与维护性。
This commit is contained in:
2026-05-25 14:34:24 +08:00
parent 270d2e9af1
commit e27a00f260
74 changed files with 4469 additions and 280 deletions

View File

@@ -11,6 +11,8 @@ use App\Lottery\DrawStatus;
use App\Models\TicketOrder;
use App\Models\TransferOrder;
use App\Models\DrawResultBatch;
use App\Models\SettlementBatch;
use App\Lottery\SettlementBatchStatus;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Lottery\DrawResultBatchStatus;
@@ -54,7 +56,8 @@ final class DashboardHallFixtureSeeder extends Seeder
DB::transaction(function () use ($draw, $player): void {
$this->seedRiskPools($draw);
$this->seedTicketOrders($draw, $player);
$this->seedPendingReviewBatch($draw);
$resultBatch = $this->seedPendingReviewBatch($draw);
$this->seedSettlementBatches($draw, $resultBatch);
$this->seedAbnormalTransfers($player);
});
@@ -269,12 +272,12 @@ final class DashboardHallFixtureSeeder extends Seeder
);
}
private function seedPendingReviewBatch(Draw $draw): void
private function seedPendingReviewBatch(Draw $draw): DrawResultBatch
{
$max = (int) DrawResultBatch::query()->where('draw_id', $draw->id)->max('result_version');
$next = max(1, $max + 1);
DrawResultBatch::query()->firstOrCreate(
return DrawResultBatch::query()->firstOrCreate(
[
'draw_id' => $draw->id,
'result_version' => $next,
@@ -291,6 +294,35 @@ final class DashboardHallFixtureSeeder extends Seeder
);
}
private function seedSettlementBatches(Draw $draw, DrawResultBatch $resultBatch): void
{
$now = Carbon::now()->utc();
$rows = [
[1, SettlementBatchStatus::PendingReview, 3, 1, 15_000, 5_000, $now->copy()->subHours(2), null],
[2, SettlementBatchStatus::Approved, 3, 2, 20_000, 5_000, $now->copy()->subHour(), $now->copy()->subMinutes(30)],
[3, SettlementBatchStatus::Completed, 3, 2, 20_000, 5_000, $now->copy()->subMinutes(45), $now->copy()->subMinutes(10)],
];
foreach ($rows as [$version, $status, $tickets, $wins, $payout, $jackpot, $started, $finished]) {
SettlementBatch::query()->firstOrCreate(
[
'draw_id' => $draw->id,
'settle_version' => $version,
],
[
'result_batch_id' => (int) $resultBatch->id,
'status' => $status->value,
'total_ticket_count' => $tickets,
'total_win_count' => $wins,
'total_payout_amount' => $payout,
'total_jackpot_payout_amount' => $jackpot,
'started_at' => $started,
'finished_at' => $finished,
],
);
}
}
private function seedAbnormalTransfers(Player $player): void
{
$rows = [