作者 刘锟

update

@@ -90,13 +90,41 @@ class DomainInfo extends Command @@ -90,13 +90,41 @@ class DomainInfo extends Command
90 } 90 }
91 } 91 }
92 92
93 - //获取证书有效期并更新 93 + //获取主站证书有效期并更新
94 $ssl_time = $this->getDomainSslTime($v['domain']); 94 $ssl_time = $this->getDomainSslTime($v['domain']);
95 if ($ssl_time['from'] && $ssl_time['to']) { 95 if ($ssl_time['from'] && $ssl_time['to']) {
96 $v->certificate_start_time = $ssl_time['from']; 96 $v->certificate_start_time = $ssl_time['from'];
97 $v->certificate_end_time = $ssl_time['to']; 97 $v->certificate_end_time = $ssl_time['to'];
98 $v->save(); 98 $v->save();
99 } 99 }
  100 +
  101 + if ($v['amp_status'] == 1) {
  102 + $domain_array = parse_url($v['domain']);
  103 + $host = $domain_array['host'] ?? $domain_array['path'];
  104 + $host_array = explode('.', $host);
  105 + if (count($host_array) <= 2) {
  106 + array_unshift($host_array, 'm');
  107 + } else {
  108 + $host_array[0] = 'm';
  109 + }
  110 + $amp_domain = implode('.', $host_array);
  111 +
  112 + if ($servers_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {
  113 + //过滤已解析到别的ip的AMP域名
  114 + if (!$this->check_cname($amp_domain, $servers_ip_info)) {
  115 + Log::channel('analyze_other')->error('AMP域名 [' . $amp_domain . '] 已解析到别的IP');
  116 + continue;
  117 + }
  118 + }
  119 +
  120 + //获取AMP站证书有效期并更新
  121 + $amp_ssl_time = $this->getDomainSslTime($amp_domain);
  122 + if ($amp_ssl_time['from'] && $amp_ssl_time['to']) {
  123 + $v->amp_certificate_start_time = $amp_ssl_time['from'];
  124 + $v->amp_certificate_end_time = $amp_ssl_time['to'];
  125 + $v->save();
  126 + }
  127 + }
100 } 128 }
101 } 129 }
102 130