feat: 添加新的错误码以支持配置版本管理,更新彩票配置以启用手动审核,增强 API 路由以支持玩法和赔率版本化管理
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Config;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\AdminUser;
|
||||
use App\Services\Config\OddsStreamService;
|
||||
use App\Support\AdminConfigPresenter;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/** POST /api/v1/admin/config/odds-versions */
|
||||
final class OddsVersionStoreController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, OddsStreamService $service): JsonResponse
|
||||
{
|
||||
/** @var AdminUser $admin */
|
||||
$admin = $request->lotteryAdmin();
|
||||
|
||||
$data = $request->validate([
|
||||
'reason' => ['nullable', 'string', 'max:255'],
|
||||
'clone_from_version_id' => ['nullable', 'integer', 'exists:odds_versions,id'],
|
||||
]);
|
||||
|
||||
$draft = $service->createDraft(
|
||||
$admin,
|
||||
$data['reason'] ?? null,
|
||||
$data['clone_from_version_id'] ?? null,
|
||||
);
|
||||
|
||||
return ApiResponse::success(
|
||||
AdminConfigPresenter::oddsVersionDetail($draft->load('items')),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user