初始化本地仓库

This commit is contained in:
2026-08-31 11:33:59 +08:00
commit 663f74b633
2390 changed files with 402918 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* This file is part of webman.
* Licensed under The MIT License
* For full copyright and license information, please see the MIT-LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @author walkor<walkor@workerman.net>
* @copyright walkor<walkor@workerman.net>
* @link http://www.workerman.net/
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use OpenApi\Annotations as OA;
use app\controller\OpenApiController;
use Webman\Route;
use WebmanTech\Swagger\DTO\ConfigOpenapiDocDTO;
use WebmanTech\Swagger\Integrations\RouteRegister;
use WebmanTech\Swagger\RouteAnnotation\Reader;
use app\adminapi\controller\terminal\TerminalSseController;
/**
* 注册admin APP路由
*/
Route::group('/adminapi', function () {
$openapiDocConfig = [
'format' => 'json',
'scan_path' => [
base_path('app/schema'), // 基础 schema
base_path('app/adminapi'),
base_path('app/install'),
],
'modify' => function (OA\OpenApi $openapi) {
$openapi->info->title = config('app.name') . ' API';
$openapi->info->version = '1.0.0';
$openapi->servers = [
new OA\Server([
'url' => '/adminapi',
'description' => request()->host(),
]),
];
/** @phpstan-ignore-next-line */
if (!$openapi->components instanceof OA\Components) {
$openapi->components = new OA\Components([]);
}
$openapi->components->securitySchemes = [
new OA\SecurityScheme([
'securityScheme' => 'api_key',
'type' => 'apiKey',
'name' => config('madong.jwt.app.token_name', 'Authorization'),
'in' => 'header',
]),
];
},
];
$openApiController = new OpenApiController();
Route::get('/openapi', static fn () => $openApiController->index('/adminapi/openapi.json'));
Route::get('/openapi.json', static fn () => $openApiController->document($openapiDocConfig));
$config = ConfigOpenapiDocDTO::fromConfig($openapiDocConfig);
RouteRegister::create()->register((new Reader())->getData($config->getScanSources()));
});