diff --git a/app/lib/DeployHelper.php b/app/lib/DeployHelper.php index 4a09afc..569eb37 100644 --- a/app/lib/DeployHelper.php +++ b/app/lib/DeployHelper.php @@ -998,7 +998,7 @@ class DeployHelper 'domain' => [ 'name' => '绑定的域名', 'type' => 'input', - 'placeholder' => '', + 'placeholder' => '多个域名可使用,分隔', 'required' => true, ], ], @@ -1035,7 +1035,7 @@ class DeployHelper 'domain' => [ 'name' => 'CDN域名', 'type' => 'input', - 'placeholder' => '', + 'placeholder' => '多个域名可使用,分隔', 'required' => true, ], ], diff --git a/app/lib/deploy/doge.php b/app/lib/deploy/doge.php index bcbc0f6..6c51392 100644 --- a/app/lib/deploy/doge.php +++ b/app/lib/deploy/doge.php @@ -28,8 +28,8 @@ class doge implements DeployInterface public function deploy($fullchain, $privatekey, $config, &$info) { - $domain = $config['domain']; - if (empty($domain)) throw new Exception('绑定的域名不能为空'); + $domains = $config['domain']; + if (empty($domains)) throw new Exception('绑定的域名不能为空'); $certInfo = openssl_x509_parse($fullchain, true); if (!$certInfo) throw new Exception('证书解析失败'); @@ -37,13 +37,14 @@ class doge implements DeployInterface $cert_id = $this->get_cert_id($fullchain, $privatekey, $cert_name); - $param = [ - 'id' => $cert_id, - 'domain' => $domain, - ]; - $this->request('/cdn/cert/bind.json', $param); - - $this->log('CDN域名 ' . $domain . ' 绑定证书成功!'); + foreach (explode(',', $domains) as $domain) { + $param = [ + 'id' => $cert_id, + 'domain' => $domain, + ]; + $this->request('/cdn/cert/bind.json', $param); + $this->log('CDN域名 ' . $domain . ' 绑定证书成功!'); + } $info['cert_id'] = $cert_id; } diff --git a/app/lib/deploy/qiniu.php b/app/lib/deploy/qiniu.php index b813d35..4b29b62 100644 --- a/app/lib/deploy/qiniu.php +++ b/app/lib/deploy/qiniu.php @@ -29,8 +29,8 @@ class qiniu implements DeployInterface public function deploy($fullchain, $privatekey, $config, &$info) { - $domain = $config['domain']; - if (empty($domain)) throw new Exception('绑定的域名不能为空'); + $domains = $config['domain']; + if (empty($domains)) throw new Exception('绑定的域名不能为空'); $certInfo = openssl_x509_parse($fullchain, true); if (!$certInfo) throw new Exception('证书解析失败'); @@ -38,14 +38,16 @@ class qiniu implements DeployInterface $cert_id = $this->get_cert_id($fullchain, $privatekey, $certInfo['subject']['CN'], $cert_name); - if ($config['product'] == 'cdn') { - $this->deploy_cdn($domain, $cert_id); - } elseif ($config['product'] == 'oss') { - $this->deploy_oss($domain, $cert_id); - } elseif ($config['product'] == 'pili') { - $this->deploy_pili($config['pili_hub'], $domain, $cert_name); - } else { - throw new Exception('未知的产品类型'); + foreach (explode(',', $domains) as $domain) { + if ($config['product'] == 'cdn') { + $this->deploy_cdn($domain, $cert_id); + } elseif ($config['product'] == 'oss') { + $this->deploy_oss($domain, $cert_id); + } elseif ($config['product'] == 'pili') { + $this->deploy_pili($config['pili_hub'], $domain, $cert_name); + } else { + throw new Exception('未知的产品类型'); + } } $info['cert_id'] = $cert_id; $info['cert_name'] = $cert_name; diff --git a/app/service/TaskRunner.php b/app/service/TaskRunner.php index 5f0fd8e..b74b750 100644 --- a/app/service/TaskRunner.php +++ b/app/service/TaskRunner.php @@ -45,9 +45,9 @@ class TaskRunner if ($row['checktype'] == 2) { $result = CheckUtils::curl($row['checkurl'], $row['timeout'], $row['main_value'], $row['proxy'] == 1); } elseif ($row['checktype'] == 1) { - $result = CheckUtils::tcp($row['main_value'], $row['tcpport'], $row['timeout']); + $result = CheckUtils::tcp($row['main_value'], $row['checkurl'], $row['tcpport'], $row['timeout']); } else { - $result = CheckUtils::ping($row['main_value']); + $result = CheckUtils::ping($row['main_value'], $row['checkurl']); } $action = 0; diff --git a/app/utils/CheckUtils.php b/app/utils/CheckUtils.php index 377be27..e99ffcb 100644 --- a/app/utils/CheckUtils.php +++ b/app/utils/CheckUtils.php @@ -72,8 +72,9 @@ class CheckUtils return ['status' => $status, 'errmsg' => $errmsg, 'usetime' => $usetime]; } - public static function tcp($target, $port, $timeout) + public static function tcp($target, $ip, $port, $timeout) { + if (!empty($ip) && filter_var($ip, FILTER_VALIDATE_IP)) $target = $ip; if (substr($target, -1) == '.') $target = substr($target, 0, -1); if (!filter_var($target, FILTER_VALIDATE_IP) && checkDomain($target)) { $target = gethostbyname($target); @@ -95,9 +96,10 @@ class CheckUtils return ['status' => $status, 'errmsg' => $errStr, 'usetime' => $usetime]; } - public static function ping($target) + public static function ping($target, $ip) { if (!function_exists('exec')) return ['status' => false, 'errmsg' => 'exec函数不可用', 'usetime' => 0]; + if (!empty($ip) && filter_var($ip, FILTER_VALIDATE_IP)) $target = $ip; if (substr($target, -1) == '.') $target = substr($target, 0, -1); if (!filter_var($target, FILTER_VALIDATE_IP) && checkDomain($target)) { $target = gethostbyname($target); diff --git a/app/view/dmonitor/taskform.html b/app/view/dmonitor/taskform.html index 5c28fa2..2d0448f 100644 --- a/app/view/dmonitor/taskform.html +++ b/app/view/dmonitor/taskform.html @@ -7,6 +7,11 @@ position: absolute; left: 0; } + .control-label[is-required]:before { + content: "*"; + color: #f56c6c; + margin-right: 4px; + } .tips{color: #f6a838; padding-left: 5px;}
@@ -16,7 +21,7 @@
- +
@@ -29,7 +34,7 @@
- +
{{option.label}} @@ -48,7 +53,7 @@
- +
@@ -63,21 +68,27 @@
- +
+
+ +
+ +
+
- +
- +
@@ -94,7 +105,7 @@
- +
@@ -103,13 +114,13 @@
- +
- +
@@ -118,7 +129,7 @@
- +