mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2026-05-02 11:56:27 +02:00
```
feat(dnspod): 添加域名状态修改功能并确保新域名启用 在dnspod DNS管理中添加了域名状态修改功能,在创建或查找域名后自动启用域名, 确保域名处于活动状态。新增modifyDomainStatus方法来处理域名状态变更请求, 并在createOrGetDomain方法中集成状态启用逻辑,提高域名管理的可靠性。 ```
This commit is contained in:
@@ -322,14 +322,21 @@ class dnspod implements DnsInterface
|
||||
];
|
||||
$data = $this->send_request($action, $param);
|
||||
if ($data) {
|
||||
return [
|
||||
$result = [
|
||||
'id' => $data['DomainInfo']['Id'],
|
||||
'name' => $data['DomainInfo']['Domain'],
|
||||
'name_servers' => $this->normalizeNameServerList($data['DomainInfo']['GradeNsList'] ?? []),
|
||||
];
|
||||
if (!$this->modifyDomainStatus($result['name'], 'enable', intval($result['id']))) {
|
||||
return false;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
$existingDomain = $this->findExactDomain($Domain);
|
||||
if ($existingDomain) {
|
||||
if (!$this->modifyDomainStatus($existingDomain['name'], 'enable', intval($existingDomain['id']))) {
|
||||
return false;
|
||||
}
|
||||
return $existingDomain;
|
||||
}
|
||||
return false;
|
||||
@@ -459,6 +466,19 @@ class dnspod implements DnsInterface
|
||||
return array_values(array_unique($result));
|
||||
}
|
||||
|
||||
private function modifyDomainStatus($domain, $status, $domainId = 0)
|
||||
{
|
||||
$param = [
|
||||
'Domain' => $domain,
|
||||
'Status' => $status,
|
||||
];
|
||||
if ($domainId > 0) {
|
||||
$param['DomainId'] = $domainId;
|
||||
}
|
||||
$data = $this->send_request('ModifyDomainStatus', $param);
|
||||
return is_array($data);
|
||||
}
|
||||
|
||||
private function findExactDomain($domain)
|
||||
{
|
||||
$data = $this->send_request('DescribeDomainList', [
|
||||
|
||||
Reference in New Issue
Block a user