添加对阿里云的支持(ecs未测试)

This commit is contained in:
MasonLiu committed 2026-06-30 01:24:49 +08:00
1 parent cbd886bd0a
commit 8cb285866f
5 files changed
+1114 -125

No files matched your search

+90
View File
@@ -300,6 +300,21 @@ function tencentGetLighthouseStatus($configId, $instanceId, $region = null, $upd
* 启动CVM实例
*/
function tencentPowerOn($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentPowerOn] 无法从数据库获取 region", 'tencentPowerOn');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];
@@ -319,6 +334,21 @@ function tencentPowerOn($configId, $instanceId, $region = null) {
* 启动轻量应用服务器
*/
function tencentLighthousePowerOn($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentLighthousePowerOn] 无法从数据库获取 region", 'tencentLighthousePowerOn');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];
@@ -338,6 +368,21 @@ function tencentLighthousePowerOn($configId, $instanceId, $region = null) {
* 停止CVM实例
*/
function tencentPowerOff($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentPowerOff] 无法从数据库获取 region", 'tencentPowerOff');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];
@@ -357,6 +402,21 @@ function tencentPowerOff($configId, $instanceId, $region = null) {
* 停止轻量应用服务器
*/
function tencentLighthousePowerOff($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentLighthousePowerOff] 无法从数据库获取 region", 'tencentLighthousePowerOff');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];
@@ -376,6 +436,21 @@ function tencentLighthousePowerOff($configId, $instanceId, $region = null) {
* 重启CVM实例
*/
function tencentReboot($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentReboot] 无法从数据库获取 region", 'tencentReboot');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];
@@ -395,6 +470,21 @@ function tencentReboot($configId, $instanceId, $region = null) {
* 重启轻量应用服务器
*/
function tencentLighthouseReboot($configId, $instanceId, $region = null) {
// 如果未提供region,从数据库获取
if (!$region) {
$listDb = getVpsListDB();
$vpsInfo = $listDb->queryOne(
'SELECT domain FROM vps_list WHERE config_id = ? AND vps_id = ?',
[$configId, $instanceId]
);
if ($vpsInfo && !empty($vpsInfo['domain'])) {
$region = $vpsInfo['domain'];
} else {
Logger::error("[tencentLighthouseReboot] 无法从数据库获取 region", 'tencentLighthouseReboot');
return ['status' => 400, 'error' => '无法获取实例区域信息'];
}
}
$params = [
'InstanceIds.0' => $instanceId,
];