feat: 扩展奖池、风控与报表能力,新增对账补偿、广播和人工操作接口
This commit is contained in:
54
app/Events/JackpotBurstBroadcast.php
Normal file
54
app/Events/JackpotBurstBroadcast.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?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;
|
||||
|
||||
/** Jackpot 爆池公共广播:`jackpot.burst` */
|
||||
final class JackpotBurstBroadcast implements ShouldBroadcastNow
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(
|
||||
public readonly int $drawId,
|
||||
public readonly string $drawNo,
|
||||
public readonly string $firstPrizeNumber,
|
||||
public readonly string $currencyCode,
|
||||
public readonly int $totalPayoutAmount,
|
||||
public readonly int $winnerCount,
|
||||
public readonly string $triggerType,
|
||||
public readonly int $poolAmountAfter,
|
||||
public readonly int $emittedAtMs,
|
||||
) {}
|
||||
|
||||
/** @return array<int, Channel> */
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [new Channel('lottery-hall')];
|
||||
}
|
||||
|
||||
public function broadcastAs(): string
|
||||
{
|
||||
return 'jackpot.burst';
|
||||
}
|
||||
|
||||
/** @return array{draw_id: int, draw_no: string, first_prize_number: string, currency_code: string, total_payout_amount: int, winner_count: int, trigger_type: string, pool_amount_after: int, emitted_at_ms: int} */
|
||||
public function broadcastWith(): array
|
||||
{
|
||||
return [
|
||||
'draw_id' => $this->drawId,
|
||||
'draw_no' => $this->drawNo,
|
||||
'first_prize_number' => $this->firstPrizeNumber,
|
||||
'currency_code' => $this->currencyCode,
|
||||
'total_payout_amount' => $this->totalPayoutAmount,
|
||||
'winner_count' => $this->winnerCount,
|
||||
'trigger_type' => $this->triggerType,
|
||||
'pool_amount_after' => $this->poolAmountAfter,
|
||||
'emitted_at_ms' => $this->emittedAtMs,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user