优化install安装流程

This commit is contained in:
2026-03-18 17:15:01 +08:00
parent 299c012063
commit e8c77943b5
32 changed files with 330 additions and 74 deletions

View File

@@ -44,7 +44,7 @@ return [
// 默认驱动方式
'default' => 'mysql',
// 加密key
'key' => '5u9HTYBPXId3i6K4S2Q08wWRVFxCENLU',
'key' => 'L1iYVS0PChKA9pjcFdmOGb4zfDIHo5xw',
// 加密方式
'algo' => 'ripemd160',
// 驱动

View File

@@ -35,16 +35,30 @@ Route::get('/index.html', function () use ($installLockFile, $installCompleteMar
});
// ==================== 安装向导(静态页) ====================
// /install、/install/、/install/index 均返回 public/install/index.html
Route::get('/install', function () {
// 已安装时访问 /install 重定向到应用,访问提示仅在终端显示
$installLockFileForInstall = public_path('install.lock');
$installCompleteMarkForInstall = 'install-end';
Route::get('/install', function () use ($installLockFileForInstall, $installCompleteMarkForInstall) {
$installed = is_file($installLockFileForInstall) && @file_get_contents($installLockFileForInstall) === $installCompleteMarkForInstall;
if ($installed && is_file(public_path('index.html'))) {
return new Response(302, ['Location' => '/index.html']);
}
$file = public_path('install/index.html');
return is_file($file) ? (new Response())->file($file) : new Response(404, [], 'Install page not found');
});
Route::get('/install/', function () {
Route::get('/install/', function () use ($installLockFileForInstall, $installCompleteMarkForInstall) {
$installed = is_file($installLockFileForInstall) && @file_get_contents($installLockFileForInstall) === $installCompleteMarkForInstall;
if ($installed && is_file(public_path('index.html'))) {
return new Response(302, ['Location' => '/index.html']);
}
$file = public_path('install/index.html');
return is_file($file) ? (new Response())->file($file) : new Response(404, [], 'Install page not found');
});
Route::get('/install/index', function () {
Route::get('/install/index', function () use ($installLockFileForInstall, $installCompleteMarkForInstall) {
$installed = is_file($installLockFileForInstall) && @file_get_contents($installLockFileForInstall) === $installCompleteMarkForInstall;
if ($installed && is_file(public_path('index.html'))) {
return new Response(302, ['Location' => '/index.html']);
}
$file = public_path('install/index.html');
return is_file($file) ? (new Response())->file($file) : new Response(404, [], 'Install page not found');
});
@@ -65,6 +79,7 @@ Route::get('/api/install/envBaseCheck', [\app\api\controller\Install::class, 'en
Route::add(['GET', 'POST'], '/api/install/envNpmCheck', [\app\api\controller\Install::class, 'envNpmCheck']);
Route::post('/api/install/testDatabase', [\app\api\controller\Install::class, 'testDatabase']);
Route::add(['GET', 'POST'], '/api/install/baseConfig', [\app\api\controller\Install::class, 'baseConfig']);
Route::get('/api/install/accessUrls', [\app\api\controller\Install::class, 'accessUrls']);
Route::post('/api/install/commandExecComplete', [\app\api\controller\Install::class, 'commandExecComplete']);
Route::post('/api/install/manualInstall', [\app\api\controller\Install::class, 'manualInstall']);
Route::post('/api/install/mvDist', [\app\api\controller\Install::class, 'mvDist']);