diff --git a/app/lib/DnsHelper.php b/app/lib/DnsHelper.php index 6e71ba9..f9a2db4 100644 --- a/app/lib/DnsHelper.php +++ b/app/lib/DnsHelper.php @@ -118,7 +118,7 @@ class DnsHelper 'sk' => 'API密钥/令牌', ], 'remark' => 2, - 'status' => false, + 'status' => true, 'redirect' => false, 'log' => false, 'weight' => false, @@ -161,8 +161,10 @@ class DnsHelper 'dnsla' => ['DEF' => '', 'CT' => '84613316902921216', 'CU' => '84613316923892736', 'CM' => '84613316953252864', 'AB' => ''], 'huoshan' => ['DEF' => 'default', 'CT' => 'telecom', 'CU' => 'unicom', 'CM' => 'mobile', 'AB' => 'oversea'], 'baidu' => ['DEF' => 'default', 'CT' => 'ct', 'CU' => 'cnc', 'CM' => 'cmnet', 'AB' => ''], + 'jdcloud' => ['DEF' => '-1', 'CT' => '1', 'CU' => '2', 'CM' => '3', 'AB' => '4'], 'cloudflare' => ['DEF' => '0'], 'namesilo' => ['DEF' => '0'], + 'powerdns' => ['DEF' => '0'], ]; public static function getList() diff --git a/app/lib/deploy/aliyun.php b/app/lib/deploy/aliyun.php index 6427268..0f638c0 100644 --- a/app/lib/deploy/aliyun.php +++ b/app/lib/deploy/aliyun.php @@ -85,7 +85,7 @@ class aliyun implements DeployInterface $param = [ 'Action' => 'ListUserCertificateOrder', 'Keyword' => $certInfo['subject']['CN'], - 'OrderType' => 'UPLOAD', + 'OrderType' => 'CERT', ]; try { $data = $client->request($param); diff --git a/app/lib/dns/baidu.php b/app/lib/dns/baidu.php index 28adbab..d19c297 100644 --- a/app/lib/dns/baidu.php +++ b/app/lib/dns/baidu.php @@ -61,8 +61,9 @@ class baidu implements DnsInterface //获取解析记录列表 public function getDomainRecords($PageNumber = 1, $PageSize = 20, $KeyWord = null, $SubDomain = null, $Value = null, $Type = null, $Line = null, $Status = null) { - $query = ['rr' => $KeyWord]; + $query = []; if (!isNullOrEmpty($SubDomain)) { + $SubDomain = strtolower($SubDomain); $query['rr'] = $SubDomain; } $data = $this->send_reuqest('GET', '/v1/dns/zone/'.$this->domain.'/record', $query); @@ -84,6 +85,32 @@ class baidu implements DnsInterface 'UpdateTime' => null, ]; } + if (!isNullOrEmpty($SubDomain)) { + $list = array_values(array_filter($list, function ($v) use ($SubDomain) { + return $v['Name'] == $SubDomain; + })); + } else { + if (!isNullOrEmpty($KeyWord)) { + $list = array_values(array_filter($list, function ($v) use ($KeyWord) { + return strpos($v['Name'], $KeyWord) !== false || strpos($v['Value'], $KeyWord) !== false; + })); + } + if (!isNullOrEmpty($Value)) { + $list = array_values(array_filter($list, function ($v) use ($Value) { + return $v['Value'] == $Value; + })); + } + if (!isNullOrEmpty($Type)) { + $list = array_values(array_filter($list, function ($v) use ($Type) { + return $v['Type'] == $Type; + })); + } + if (!isNullOrEmpty($Status)) { + $list = array_values(array_filter($list, function ($v) use ($Status) { + return $v['Status'] == $Status; + })); + } + } return ['total' => count($list), 'list' => $list]; } return false; diff --git a/app/lib/dns/cloudflare.php b/app/lib/dns/cloudflare.php index d515675..5ce7a4c 100644 --- a/app/lib/dns/cloudflare.php +++ b/app/lib/dns/cloudflare.php @@ -76,6 +76,8 @@ class cloudflare implements DnsInterface $list = []; foreach ($data['result'] as $row) { $name = $this->domain == $row['name'] ? '@' : str_replace('.'.$this->domain, '', $row['name']); + $status = str_ends_with($name, '_pause') ? '0' : '1'; + $name = $status == '0' ? substr($name, 0, -6) : $name; $list[] = [ 'RecordId' => $row['id'], 'Domain' => $this->domain, @@ -85,7 +87,7 @@ class cloudflare implements DnsInterface 'Line' => $row['proxied'] ? '1' : '0', 'TTL' => $row['ttl'], 'MX' => isset($row['priority']) ? $row['priority'] : null, - 'Status' => '1', + 'Status' => $status, 'Weight' => null, 'Remark' => $row['comment'], 'UpdateTime' => $row['modified_on'], @@ -108,6 +110,8 @@ class cloudflare implements DnsInterface $data = $this->send_reuqest('GET', '/zones/'.$this->domainid.'/dns_records/'.$RecordId); if ($data) { $name = $this->domain == $data['result']['name'] ? '@' : str_replace('.' . $this->domain, '', $data['result']['name']); + $status = str_ends_with($name, '_pause') ? '0' : '1'; + $name = $status == '0' ? substr($name, 0, -6) : $name; return [ 'RecordId' => $data['result']['id'], 'Domain' => $this->domain, @@ -117,7 +121,7 @@ class cloudflare implements DnsInterface 'Line' => $data['result']['proxied'] ? '1' : '0', 'TTL' => $data['result']['ttl'], 'MX' => isset($data['result']['priority']) ? $data['result']['priority'] : null, - 'Status' => '1', + 'Status' => $status, 'Weight' => null, 'Remark' => $data['result']['comment'], 'UpdateTime' => $data['result']['modified_on'], @@ -168,7 +172,9 @@ class cloudflare implements DnsInterface //设置解析记录状态 public function setDomainRecordStatus($RecordId, $Status) { - return false; + $info = $this->getDomainRecordInfo($RecordId); + $Name = $Status == '1' ? str_replace('_pause', '', $info['Name']) : $info['Name'] . '_pause'; + return $this->updateDomainRecord($RecordId, $Name, $info['Type'], $info['Value'], $info['Line'], $info['TTL'], $info['MX'], $info['Weight'], $info['Remark']); } //获取解析记录操作日志 diff --git a/app/lib/dns/huoshan.php b/app/lib/dns/huoshan.php index 043f4be..c8ccdf7 100644 --- a/app/lib/dns/huoshan.php +++ b/app/lib/dns/huoshan.php @@ -77,7 +77,7 @@ class huoshan implements DnsInterface { $query = ['ZID' => intval($this->domainid), 'PageNumber' => $PageNumber, 'PageSize' => $PageSize, 'SearchOrder' => 'desc']; if (!empty($SubDomain) || !empty($Type) || !empty($Line) || !empty($Value)) { - $query += ['Host' => $SubDomain, 'Value' => $Value, 'Type' => $Type, 'Line' => $Line]; + $query += ['Host' => $SubDomain, 'Value' => $Value, 'Type' => $Type, 'Line' => $Line, 'SearchMode' => 'exact']; } elseif (!empty($KeyWord)) { $query += ['Host' => $KeyWord]; } diff --git a/app/lib/dns/jdcloud.php b/app/lib/dns/jdcloud.php index dfee9cc..f877b29 100644 --- a/app/lib/dns/jdcloud.php +++ b/app/lib/dns/jdcloud.php @@ -69,9 +69,10 @@ class jdcloud implements DnsInterface public function getDomainRecords($PageNumber = 1, $PageSize = 20, $KeyWord = null, $SubDomain = null, $Value = null, $Type = null, $Line = null, $Status = null) { $query = ['pageNumber' => $PageNumber, 'pageSize' => $PageSize]; - if (!empty($SubDomain)) { + if (!isNullOrEmpty($SubDomain)) { + $SubDomain = strtolower($SubDomain); $query += ['search' => $SubDomain]; - } elseif (!empty($KeyWord)) { + } elseif (!isNullOrEmpty($KeyWord)) { $query += ['search' => $KeyWord]; } $data = $this->send_request('GET', '/domain/'.$this->domainid.'/ResourceRecord', $query); @@ -96,6 +97,11 @@ class jdcloud implements DnsInterface 'UpdateTime' => date('Y-m-d H:i:s', $row['updateTime']), ]; } + if (!isNullOrEmpty($SubDomain) && !empty($list)) { + $list = array_values(array_filter($list, function ($v) use ($SubDomain) { + return $v['Name'] == $SubDomain; + })); + } return ['total' => $data['totalCount'], 'list' => $list]; } return false; diff --git a/app/lib/dns/namesilo.php b/app/lib/dns/namesilo.php index bcecac7..2ecb64a 100644 --- a/app/lib/dns/namesilo.php +++ b/app/lib/dns/namesilo.php @@ -81,7 +81,7 @@ class namesilo implements DnsInterface } if(!isNullOrEmpty($SubDomain)){ $list = array_values(array_filter($list, function($v) use ($SubDomain){ - return $v['Name'] == $SubDomain; + return strcasecmp($v['Name'], $SubDomain) === 0; })); }else{ if(!isNullOrEmpty($KeyWord)){ diff --git a/app/lib/dns/powerdns.php b/app/lib/dns/powerdns.php index 12f1adc..d978d17 100644 --- a/app/lib/dns/powerdns.php +++ b/app/lib/dns/powerdns.php @@ -93,7 +93,7 @@ class powerdns implements DnsInterface cache('powerdns_' . $this->domainid, $data['rrsets'], 86400); if (!isNullOrEmpty($SubDomain)) { $list = array_values(array_filter($list, function ($v) use ($SubDomain) { - return $v['Name'] == $SubDomain; + return strcasecmp($v['Name'], $SubDomain) === 0; })); } else { if (!isNullOrEmpty($KeyWord)) {