feat: 支持开奖设置走系统配置并补充相关测试

This commit is contained in:
2026-05-20 13:54:32 +08:00
parent 5742853c4c
commit 2753590685
4 changed files with 68 additions and 2 deletions

View File

@@ -7,6 +7,7 @@ use App\Models\AdminUser;
use App\Lottery\DrawStatus;
use App\Models\DrawResultBatch;
use Illuminate\Support\Facades\DB;
use App\Services\LotterySettings;
use App\Lottery\DrawResultBatchStatus;
/**
@@ -67,7 +68,10 @@ final class DrawPublishService
private function applyPublishedToDraw(Draw $draw, DrawResultBatch $batch): Draw
{
$cooldownMinutes = (int) config('lottery.draw.cooldown_minutes', 15);
$cooldownMinutes = max(0, (int) LotterySettings::get(
'draw.cooldown_minutes',
(int) config('lottery.draw.cooldown_minutes', 15),
));
if ($cooldownMinutes > 0) {
$draw->forceFill([
'status' => DrawStatus::Cooldown->value,

View File

@@ -8,6 +8,7 @@ use App\Lottery\DrawStatus;
use App\Models\DrawResultItem;
use App\Models\DrawResultBatch;
use Illuminate\Support\Facades\DB;
use App\Services\LotterySettings;
use App\Lottery\DrawResultSourceType;
use App\Lottery\DrawResultBatchStatus;
@@ -27,7 +28,10 @@ final class DrawRngRunner
'status' => DrawStatus::Drawing->value,
])->save();
$manualReview = (bool) config('lottery.draw.require_manual_review', false);
$manualReview = (bool) LotterySettings::get(
'draw.require_manual_review',
(bool) config('lottery.draw.require_manual_review', false),
);
$seedMaterial = bin2hex(random_bytes(32));
$rngSeedHash = hash('sha256', $seedMaterial);