AI代码生成工具
This commit is contained in:
75
app/Http/Controllers/Api/ApiEndpointController.php
Normal file
75
app/Http/Controllers/Api/ApiEndpointController.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\ApiEndpointService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* 接口注册表控制器:仅开放 list / update
|
||||
*/
|
||||
class ApiEndpointController extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = ApiEndpointService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
* @Method GET
|
||||
*/
|
||||
public function list(): JsonResponse
|
||||
{
|
||||
return jok($this->service->list(), '获取成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新接口说明 / 是否记日志 / 状态
|
||||
* @Method POST
|
||||
*/
|
||||
public function update(): JsonResponse
|
||||
{
|
||||
$params = request()->post();
|
||||
$id = (int) ($params['id'] ?? 0);
|
||||
if ($id <= 0) {
|
||||
return jerr('参数错误');
|
||||
}
|
||||
unset($params['id']);
|
||||
return jok($this->service->update($id, $params), '更新成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Method NO
|
||||
*/
|
||||
public function option(): mixed
|
||||
{
|
||||
return jerr('不支持');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Method NO
|
||||
*/
|
||||
public function detail(): JsonResponse
|
||||
{
|
||||
return jerr('不支持');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Method NO
|
||||
*/
|
||||
public function create(): JsonResponse
|
||||
{
|
||||
return jerr('不支持');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Method NO
|
||||
*/
|
||||
public function delete(): JsonResponse
|
||||
{
|
||||
return jerr('不支持');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user