支持所有游戏按房间范围配置和运行
This commit is contained in:
@@ -19,10 +19,22 @@ use App\Models\LotteryIssue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
|
||||
/**
|
||||
* 类功能:按房间创建一条新的双色球期次。
|
||||
*/
|
||||
class OpenLotteryIssueJob implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* 构造开期任务。
|
||||
*
|
||||
* @param int $roomId 目标房间
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly int $roomId = 1,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 最大重试次数。
|
||||
*/
|
||||
@@ -38,7 +50,7 @@ class OpenLotteryIssueJob implements ShouldQueue
|
||||
}
|
||||
|
||||
// 已有进行中的期次则跳过
|
||||
if (LotteryIssue::currentIssue()) {
|
||||
if (LotteryIssue::currentIssue($this->roomId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,7 +68,8 @@ class OpenLotteryIssueJob implements ShouldQueue
|
||||
$closeAt = $drawAt->copy()->subMinutes($stopMinutes);
|
||||
|
||||
LotteryIssue::create([
|
||||
'issue_no' => LotteryIssue::nextIssueNo(),
|
||||
'room_id' => $this->roomId,
|
||||
'issue_no' => LotteryIssue::nextIssueNo($this->roomId),
|
||||
'status' => 'open',
|
||||
'pool_amount' => 0,
|
||||
'carry_amount' => 0,
|
||||
|
||||
Reference in New Issue
Block a user