no message

This commit is contained in:
kuaifan 2025-05-18 13:25:13 +08:00
parent 58f286efe4
commit 04b6b8aa8a

View File

@ -133,7 +133,7 @@ class Apps
} }
$RESULTS['generate'] = $res['data']; $RESULTS['generate'] = $res['data'];
// 生成nginx文件 // 生成nginx配置文件
$nginxSourceFile = base_path('docker/appstore/apps/' . $appName . '/' . $versionInfo['version'] . '/nginx.conf'); $nginxSourceFile = base_path('docker/appstore/apps/' . $appName . '/' . $versionInfo['version'] . '/nginx.conf');
$nginxTargetFile = base_path('docker/appstore/configs/' . $appName . '/nginx.conf'); $nginxTargetFile = base_path('docker/appstore/configs/' . $appName . '/nginx.conf');
$nginxContent = ''; $nginxContent = '';
@ -208,18 +208,42 @@ class Apps
// 处理安装成功或卸载成功后的操作 // 处理安装成功或卸载成功后的操作
$message = '更新成功'; $message = '更新成功';
if ($status == 'installed') { switch ($status) {
// 处理安装成功后的操作 case 'installed':
$message = '安装成功'; $message = '安装成功';
} elseif ($status == 'not_installed') { break;
// 处理卸载成功后的操作
$message = '卸载成功'; case 'not_installed':
$message = '卸载成功';
break;
case 'error':
if ($appInfo['status'] === 'installing') {
$message = '安装失败';
self::removeNginxConfig($appName);
} else {
$message = '卸载失败';
}
break;
} }
// 返回结果 // 返回结果
return Base::retSuccess($message); return Base::retSuccess($message);
} }
/**
* 删除nginx配置文件
* @param string $appName
* @return void
*/
private static function removeNginxConfig(string $appName): void
{
$nginxFile = base_path('docker/appstore/configs/' . $appName . '/nginx.conf');
if (file_exists($nginxFile)) {
unlink($nginxFile);
}
}
/** /**
* 获取应用信息 * 获取应用信息
* *