feat: 添加 Laravel Reverb 支持,更新 .env.example 文件以配置 WebSocket,增强彩票调度功能,更新 API 路由以支持期号管理与结果发布

This commit is contained in:
2026-05-09 17:40:49 +08:00
parent 781cf10928
commit aeaf124096
42 changed files with 3886 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands;
use App\Services\Draw\DrawTickService;
use Illuminate\Console\Command;
class LotteryDrawTickCommand extends Command
{
protected $signature = 'lottery:draw-tick';
protected $description = '封盘、开奖 RNG、补齐期号缓冲每分钟调度入口';
public function handle(DrawTickService $tickService): int
{
$report = $tickService->tick();
$statusSum = array_sum($report['status_updates'] ?? []);
$this->info(sprintf(
'Status rows updated: %d | RNG runs: %d | Planned draws created: %d',
$statusSum,
$report['rng_rung'],
$report['planned']['created'] ?? 0,
));
foreach ($report['rng_errors'] as $err) {
$this->warn($err);
}
return self::SUCCESS;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace App\Console\Commands;
use App\Services\Draw\LotteryHallRealtimeBroadcaster;
use Illuminate\Console\Command;
class LotteryHallCountdownCommand extends Command
{
protected $signature = 'lottery:hall-countdown';
protected $description = '大厅 countdown WebSocket`draw.countdown`(每秒;见界面文档 §2.1';
public function handle(LotteryHallRealtimeBroadcaster $broadcaster): int
{
$broadcaster->countdownPulse();
return self::SUCCESS;
}
}