|
...
|
...
|
@@ -18,7 +18,6 @@ class EmergencyRecords extends Command |
|
|
|
//类型,1受灾,2恢复
|
|
|
|
$type = $this->argument('type');
|
|
|
|
|
|
|
|
try {
|
|
|
|
//获取服务器的所有可用ip
|
|
|
|
$server_ip_model = new ServersIp();
|
|
|
|
$server_ip_list = $server_ip_model->where('servers_id', $server_id)->where('status', 0)->get();
|
|
...
|
...
|
@@ -32,7 +31,12 @@ class EmergencyRecords extends Command |
|
|
|
//获取解析记录
|
|
|
|
$domain_array = explode('.', $value->domain);
|
|
|
|
$domain_rr = $domain_array[0];
|
|
|
|
try {
|
|
|
|
$record = AlibabaCloudService::describeDomainRecords('globalso.com', $domain_rr);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$record_status_code = $record['statusCode'] ?? 0;
|
|
|
|
if ($record_status_code != 200) {
|
|
|
|
$this->output('获取主机记录 ' . $domain_rr . ' 解析数据失败');
|
|
...
|
...
|
@@ -55,8 +59,12 @@ class EmergencyRecords extends Command |
|
|
|
$record_id = $record_detail['RecordId'];
|
|
|
|
$record_rr = $record_detail['RR'];
|
|
|
|
$record_type = $record_detail['Type'];
|
|
|
|
|
|
|
|
try {
|
|
|
|
$record_edit = AlibabaCloudService::updateDomainRecord($record_id, $record_rr, $record_type, $target_ip);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$record_edit_status_code = $record_edit['statusCode'] ?? 0;
|
|
|
|
if ($record_edit_status_code == 200) {
|
|
|
|
$this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 成功');
|
|
...
|
...
|
@@ -65,9 +73,6 @@ class EmergencyRecords extends Command |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->output($e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|