feat: 切换 schema dump 基线并增强返点结算与管理校验
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user