引入 CurrencyResolver,用于在 DrawCurrentController、DrawResultShowController 与 DrawResultsIndexController 中统一处理币种代码解析。 更新 DrawHallSnapshotBuilder 与 DrawResultViewService 的构建方法,新增币种代码参数支持,确保开奖相关功能中的币种处理一致性。 增强 SettingIndexController:新增允许访问的 KV 配置分组校验。 在 OddsStreamService、PlayConfigStreamService 与 RiskCapStreamService 中新增广播功能,用于在玩法目录变更时推送更新通知。 新增测试用例,验证风险限额发布的广播行为。
59 lines
1.8 KiB
PHP
59 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Broadcasting\Channel;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Foundation\Events\Dispatchable;
|
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
|
|
|
|
/**
|
|
* 界面文档扩展:`play.catalog_updated` —— 玩法目录/限额/封顶等生效版本变更。
|
|
*
|
|
* 触发时机:后台发布玩法配置、赔率、风控封顶版本(及同类全量变更)时。
|
|
* 前端处理:重新拉取 `GET /api/v1/play/effective`。
|
|
*/
|
|
final class PlayCatalogUpdatedBroadcast implements ShouldBroadcastNow
|
|
{
|
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
|
|
|
/**
|
|
* @param string $module play_config|odds|risk_cap
|
|
* @param array<string, mixed>|null $meta
|
|
*/
|
|
public function __construct(
|
|
public readonly string $module,
|
|
public readonly int $versionId,
|
|
public readonly string $versionLabel,
|
|
public readonly ?array $meta,
|
|
public readonly int $emittedAtMs,
|
|
) {}
|
|
|
|
/** @return array<int, Channel> */
|
|
public function broadcastOn(): array
|
|
{
|
|
return [new Channel('lottery-hall')];
|
|
}
|
|
|
|
public function broadcastAs(): string
|
|
{
|
|
return 'play.catalog_updated';
|
|
}
|
|
|
|
/**
|
|
* @return array{module: string, version_id: int, version_label: string, meta: array<string, mixed>|null, message: string, emitted_at_ms: int}
|
|
*/
|
|
public function broadcastWith(): array
|
|
{
|
|
return [
|
|
'module' => $this->module,
|
|
'version_id' => $this->versionId,
|
|
'version_label' => $this->versionLabel,
|
|
'meta' => $this->meta,
|
|
'message' => '玩法配置已更新,请刷新后下注',
|
|
'emitted_at_ms' => $this->emittedAtMs,
|
|
];
|
|
}
|
|
}
|