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

@@ -23,7 +23,10 @@ final class DrawRngRunController extends Controller
$batch = DB::transaction(function () use ($draw) {
/** @var Draw $locked */
$locked = Draw::query()->whereKey($draw->id)->lockForUpdate()->firstOrFail();
if ($locked->status !== DrawStatus::Closed->value || $locked->resultBatches()->exists()) {
if ($locked->status !== DrawStatus::Closed->value || (int) $locked->settle_version > 0) {
throw new \RuntimeException('draw_not_runnable');
}
if (! (bool) $locked->is_reopened && $locked->resultBatches()->exists()) {
throw new \RuntimeException('draw_not_runnable');
}