作者 lyh
@@ -18,7 +18,6 @@ class EmergencyRecords extends Command @@ -18,7 +18,6 @@ class EmergencyRecords extends Command
18 //类型,1受灾,2恢复 18 //类型,1受灾,2恢复
19 $type = $this->argument('type'); 19 $type = $this->argument('type');
20 20
21 - try {  
22 //获取服务器的所有可用ip 21 //获取服务器的所有可用ip
23 $server_ip_model = new ServersIp(); 22 $server_ip_model = new ServersIp();
24 $server_ip_list = $server_ip_model->where('servers_id', $server_id)->where('status', 0)->get(); 23 $server_ip_list = $server_ip_model->where('servers_id', $server_id)->where('status', 0)->get();
@@ -32,7 +31,12 @@ class EmergencyRecords extends Command @@ -32,7 +31,12 @@ class EmergencyRecords extends Command
32 //获取解析记录 31 //获取解析记录
33 $domain_array = explode('.', $value->domain); 32 $domain_array = explode('.', $value->domain);
34 $domain_rr = $domain_array[0]; 33 $domain_rr = $domain_array[0];
  34 + try {
35 $record = AlibabaCloudService::describeDomainRecords('globalso.com', $domain_rr); 35 $record = AlibabaCloudService::describeDomainRecords('globalso.com', $domain_rr);
  36 + } catch (\Exception $e) {
  37 + $this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
  38 + continue;
  39 + }
36 $record_status_code = $record['statusCode'] ?? 0; 40 $record_status_code = $record['statusCode'] ?? 0;
37 if ($record_status_code != 200) { 41 if ($record_status_code != 200) {
38 $this->output('获取主机记录 ' . $domain_rr . ' 解析数据失败'); 42 $this->output('获取主机记录 ' . $domain_rr . ' 解析数据失败');
@@ -55,8 +59,12 @@ class EmergencyRecords extends Command @@ -55,8 +59,12 @@ class EmergencyRecords extends Command
55 $record_id = $record_detail['RecordId']; 59 $record_id = $record_detail['RecordId'];
56 $record_rr = $record_detail['RR']; 60 $record_rr = $record_detail['RR'];
57 $record_type = $record_detail['Type']; 61 $record_type = $record_detail['Type'];
58 - 62 + try {
59 $record_edit = AlibabaCloudService::updateDomainRecord($record_id, $record_rr, $record_type, $target_ip); 63 $record_edit = AlibabaCloudService::updateDomainRecord($record_id, $record_rr, $record_type, $target_ip);
  64 + } catch (\Exception $e) {
  65 + $this->output('主机记录 ' . $domain_rr . 'error:' . $e->getMessage());
  66 + continue;
  67 + }
60 $record_edit_status_code = $record_edit['statusCode'] ?? 0; 68 $record_edit_status_code = $record_edit['statusCode'] ?? 0;
61 if ($record_edit_status_code == 200) { 69 if ($record_edit_status_code == 200) {
62 $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 成功'); 70 $this->output('修改主机记录 ' . $record_rr . ' 的值为 ' . $target_ip . ' 成功');
@@ -65,9 +73,6 @@ class EmergencyRecords extends Command @@ -65,9 +73,6 @@ class EmergencyRecords extends Command
65 } 73 }
66 } 74 }
67 } 75 }
68 - } catch (\Exception $e) {  
69 - $this->output($e->getMessage());  
70 - }  
71 } 76 }
72 77
73 /** 78 /**