feat: 支持开奖重开与风险池原子扣减,完善投注部分成功流程

This commit is contained in:
2026-05-18 11:28:11 +08:00
parent 4f143c7cb1
commit 9157dcb6a1
14 changed files with 526 additions and 103 deletions

View File

@@ -88,7 +88,11 @@ final class DrawRngRunner
->where('status', DrawStatus::Closed->value)
->whereNotNull('draw_time')
->where('draw_time', '<=', $nowUtc)
->whereDoesntHave('resultBatches')
->where('settle_version', 0)
->where(function ($q): void {
$q->where('is_reopened', true)
->orWhereDoesntHave('resultBatches');
})
->orderBy('draw_time')
->pluck('id');
@@ -100,7 +104,10 @@ final class DrawRngRunner
if ($locked === null || $locked->status !== DrawStatus::Closed->value) {
return;
}
if ($locked->resultBatches()->exists()) {
if ((int) $locked->settle_version > 0) {
return;
}
if (! (bool) $locked->is_reopened && $locked->resultBatches()->exists()) {
return;
}
$this->executeLocked($locked);