mirror of
https://github.com/netcccyun/dnsmgr.git
synced 2024-11-15 19:22:22 +08:00
fix
This commit is contained in:
parent
7201476e9c
commit
8d653b872a
|
@ -5,6 +5,7 @@ use app\BaseController;
|
|||
use Exception;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Cache;
|
||||
use app\lib\DnsHelper;
|
||||
|
||||
class Dmonitor extends BaseController
|
||||
|
@ -222,7 +223,7 @@ class Dmonitor extends BaseController
|
|||
continue;
|
||||
}
|
||||
config_set($key, $value);
|
||||
Cache::clear();
|
||||
Cache::delete('configs');
|
||||
}
|
||||
return json(['code'=>0, 'msg'=>'succ']);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ class Index extends BaseController
|
|||
cookie('admin_skin', null);
|
||||
}
|
||||
config_set('admin_skin', $skin);
|
||||
Cache::clear();
|
||||
Cache::delete('configs');
|
||||
}else{
|
||||
cookie('admin_skin', $skin);
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ class huawei implements DnsInterface {
|
|||
$query = ['type' => $Type, 'line_id' => $Line, 'name' => $KeyWord, 'status' => $Status, 'offset' => $offset, 'limit' => $PageSize];
|
||||
if(!isNullOrEmpty(($SubDomain))){
|
||||
$query['name'] = $SubDomain;
|
||||
$query['search_mode'] = 'equal';
|
||||
}
|
||||
$data = $this->send_reuqest('GET', '/v2.1/zones/'.$this->domainid.'/recordsets', $query);
|
||||
if($data){
|
||||
|
@ -82,7 +83,7 @@ class huawei implements DnsInterface {
|
|||
|
||||
//获取子域名解析记录列表
|
||||
public function getSubDomainRecords($SubDomain, $PageNumber=1, $PageSize=20, $Type = null, $Line = null){
|
||||
if($SubDomain == '')$SubDomain='@';
|
||||
$SubDomain = $this->getHost($SubDomain);
|
||||
return $this->getDomainRecords($PageNumber, $PageSize, null, $SubDomain, $Type, $Line);
|
||||
}
|
||||
|
||||
|
@ -110,9 +111,7 @@ class huawei implements DnsInterface {
|
|||
|
||||
//添加解析记录
|
||||
public function addDomainRecord($Name, $Type, $Value, $Line = '0', $TTL = 600, $MX = 1, $Remark = null){
|
||||
if($Name == '@') $Name = '';
|
||||
else $Name .= '.';
|
||||
$Name .= $this->domain . '.';
|
||||
$Name = $this->getHost($Name);
|
||||
$params = ['name' => $Name, 'type' => $this->convertType($Type), 'records' => [$Value], 'line'=>$Line, 'ttl' => intval($TTL), 'description' => $Remark];
|
||||
if($Type == 'MX')$param['weight'] = intval($MX);
|
||||
$data = $this->send_reuqest('POST', '/v2.1/zones/'.$this->domainid.'/recordsets', null, $params);
|
||||
|
@ -121,9 +120,7 @@ class huawei implements DnsInterface {
|
|||
|
||||
//修改解析记录
|
||||
public function updateDomainRecord($RecordId, $Name, $Type, $Value, $Line = '0', $TTL = 600, $MX = 1, $Remark = null){
|
||||
if($Name == '@') $Name = '';
|
||||
else $Name .= '.';
|
||||
$Name .= $this->domain . '.';
|
||||
$Name = $this->getHost($Name);
|
||||
$params = ['name' => $Name, 'type' => $this->convertType($Type), 'records' => [$Value], 'line'=>$Line, 'ttl' => intval($TTL), 'description' => $Remark];
|
||||
if($Type == 'MX')$param['weight'] = intval($MX);
|
||||
$data = $this->send_reuqest('PUT', '/v2.1/zones/'.$this->domainid.'/recordsets/'.$RecordId, null, $params);
|
||||
|
@ -199,6 +196,13 @@ class huawei implements DnsInterface {
|
|||
return $type;
|
||||
}
|
||||
|
||||
private function getHost($Name){
|
||||
if($Name == '@') $Name = '';
|
||||
else $Name .= '.';
|
||||
$Name .= $this->domain . '.';
|
||||
return $Name;
|
||||
}
|
||||
|
||||
private function send_reuqest($method, $path, $query = null, $params = null){
|
||||
if(!empty($query)){
|
||||
$query = array_filter($query, function($a){ return $a!==null;});
|
||||
|
@ -324,6 +328,9 @@ class huawei implements DnsInterface {
|
|||
if(isset($arr['error_msg'])){
|
||||
$this->setError($arr['error_msg']);
|
||||
return false;
|
||||
}elseif(isset($arr['message'])){
|
||||
$this->setError($arr['message']);
|
||||
return false;
|
||||
}else{
|
||||
return $arr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user