feat: 切换 schema dump 基线并增强返点结算与管理校验

This commit is contained in:
2026-06-08 17:41:41 +08:00
parent 2d32f006c5
commit 8d5d7f5b17
130 changed files with 5746 additions and 6723 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api\V1\Admin\Jackpot;
use App\Models\AdminUser;
use App\Models\Draw;
use App\Models\JackpotPool;
use App\Support\ApiResponse;
use App\Support\ApiMessage;
@@ -40,11 +41,21 @@ final class AdminJackpotPoolManualBurstController extends Controller
}
$data = $request->validate([
'draw_id' => 'required|integer|exists:draws,id',
'draw_id' => ['required'],
]);
$drawId = $this->resolveDrawId(trim((string) $data['draw_id']));
if ($drawId === null) {
return ApiResponse::error(
trans('validation.exists', ['attribute' => 'draw_id'], $request->lotteryLocale()),
ErrorCode::ClientHttpError->value,
['draw_id' => [trans('validation.exists', ['attribute' => 'draw_id'], $request->lotteryLocale())]],
422,
);
}
try {
$payload = $this->service->execute($pool, (int) $data['draw_id']);
$payload = $this->service->execute($pool, $drawId);
} catch (\RuntimeException $e) {
return ApiResponse::error(
ApiMessage::get($request, 'jackpot_manual_burst_failed', [
@@ -58,4 +69,22 @@ final class AdminJackpotPoolManualBurstController extends Controller
return ApiResponse::success($payload);
}
private function resolveDrawId(string $drawRef): ?int
{
if ($drawRef === '') {
return null;
}
if (ctype_digit($drawRef)) {
$draw = Draw::query()->whereKey((int) $drawRef)->first();
if ($draw !== null) {
return (int) $draw->id;
}
}
$draw = Draw::query()->where('draw_no', $drawRef)->first();
return $draw !== null ? (int) $draw->id : null;
}
}