修复页面加载错误,支持dnspod国际版

This commit is contained in:
net909 2024-07-07 13:39:27 +08:00
parent f43f2b196d
commit 14700052b8
12 changed files with 57 additions and 25 deletions

View File

@ -7,6 +7,7 @@ use think\facade\Db;
use think\facade\View; use think\facade\View;
use think\facade\Request; use think\facade\Request;
use app\lib\DnsHelper; use app\lib\DnsHelper;
use Exception;
class Domain extends BaseController class Domain extends BaseController
{ {
@ -253,9 +254,9 @@ class Domain extends BaseController
$minTTL = cache('min_ttl_'.$drow['id']); $minTTL = cache('min_ttl_'.$drow['id']);
if(empty($recordLine)){ if(empty($recordLine)){
$dns = DnsHelper::getModel($drow['aid'], $drow['name'], $drow['thirdid']); $dns = DnsHelper::getModel($drow['aid'], $drow['name'], $drow['thirdid']);
if(!$dns) return $this->alert('error', 'DNS模块不存在'); if(!$dns) throw new Exception('DNS模块不存在');
$recordLine = $dns->getRecordLine(); $recordLine = $dns->getRecordLine();
if(!$recordLine) return $this->alert('error', '获取解析线路列表失败,'.$dns->getError()); if(!$recordLine) throw new Exception('获取解析线路列表失败,'.$dns->getError());
cache('record_line_'.$drow['id'], $recordLine, 604800); cache('record_line_'.$drow['id'], $recordLine, 604800);
$minTTL = $dns->getMinTTL(); $minTTL = $dns->getMinTTL();
if($minTTL){ if($minTTL){

View File

@ -12,6 +12,7 @@ class dnspod implements DnsInterface {
private $error; private $error;
private $domain; private $domain;
private $domainid; private $domainid;
private $domainInfo;
function __construct($config){ function __construct($config){
$this->SecretId = $config['ak']; $this->SecretId = $config['ak'];
@ -24,7 +25,7 @@ class dnspod implements DnsInterface {
} }
public function check(){ public function check(){
if($this->getAccountInfo() != false){ if($this->getDomainList() != false){
return true; return true;
} }
return false; return false;
@ -194,6 +195,15 @@ class dnspod implements DnsInterface {
$list = []; $list = [];
$this->processLineList($list, $data['LineList'], null); $this->processLineList($list, $data['LineList'], null);
return $list; return $list;
}else{
$data = $this->getRecordLineByGrade();
if($data){
$list = [];
foreach($data as $row){
$list[$row['LineId']] = ['name'=>$row['Name'], 'parent'=>null];
}
return $list;
}
} }
return false; return false;
} }
@ -211,11 +221,12 @@ class dnspod implements DnsInterface {
//获取域名概览信息 //获取域名概览信息
public function getDomainInfo(){ public function getDomainInfo(){
$action = 'DescribeDomainPreview'; $action = 'DescribeDomain';
$param = ['Domain' => $this->domain]; $param = ['Domain' => $this->domain];
$data = $this->send_reuqest($action, $param); $data = $this->send_reuqest($action, $param);
if($data){ if($data){
return $data['Domain']; $this->domainInfo = $data['DomainInfo'];
return $data['DomainInfo'];
} }
return false; return false;
} }
@ -233,16 +244,36 @@ class dnspod implements DnsInterface {
//获取域名最低TTL //获取域名最低TTL
public function getMinTTL(){ public function getMinTTL(){
if($this->domainInfo){
return $this->domainInfo['TTL'];
}
$PurviewList = $this->getDomainPurview(); $PurviewList = $this->getDomainPurview();
if($PurviewList){ if($PurviewList){
foreach($PurviewList as $row){ foreach($PurviewList as $row){
if($row['Name'] == '记录 TTL 最低'){ if($row['Name'] == '记录 TTL 最低' || $row['Name'] == 'Min TTL value'){
return intval($row['Value']); return intval($row['Value']);
} }
} }
} }
return false; return false;
} }
//获取等级允许的线路
public function getRecordLineByGrade(){
$action = 'DescribeRecordLineList';
$param = ['Domain' => $this->domain, 'DomainGrade' => ''];
$data = $this->send_reuqest($action, $param);
if($data){
$line_list = $data['LineList'];
if(!empty($data['LineGroupList'])){
foreach($data['LineGroupList'] as $row){
$line_list[] = ['Name' => $row['Name'], 'LineId' => $row['LineId']];
}
return $line_list;
}
}
return false;
}
//获取用户信息 //获取用户信息
public function getAccountInfo(){ public function getAccountInfo(){

View File

@ -18,7 +18,7 @@ class ViewOutput
{ {
View::assign('islogin', $request->islogin); View::assign('islogin', $request->islogin);
View::assign('user', $request->user); View::assign('user', $request->user);
View::assign('cdnpublic', '//lib.baomitu.com/'); View::assign('cdnpublic', 'https://s4.zstatic.net/ajax/libs/');
View::assign('skin', getAdminSkin()); View::assign('skin', getAdminSkin());
return $next($request); return $next($request);
} }

View File

@ -33,8 +33,8 @@ tbody tr>td:nth-child(2){overflow: hidden;text-overflow: ellipsis;white-space: n
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){

View File

@ -30,8 +30,8 @@ tbody tr>td:nth-child(4){overflow: hidden;text-overflow: ellipsis;white-space: n
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
var action_name = {$info.action_name|json_encode|raw}; var action_name = {$info.action_name|json_encode|raw};

View File

@ -81,8 +81,8 @@
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
var dnsconfig = {$dnsconfig|json_encode|raw}; var dnsconfig = {$dnsconfig|json_encode|raw};

View File

@ -118,8 +118,8 @@
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="{$cdnpublic}select2/4.0.13/js/select2.min.js"></script> <script src="{$cdnpublic}select2/4.0.13/js/select2.min.js"></script>
<script src="{$cdnpublic}select2/4.0.13/js/i18n/zh-CN.min.js"></script> <script src="{$cdnpublic}select2/4.0.13/js/i18n/zh-CN.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>

View File

@ -16,8 +16,8 @@
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){

View File

@ -222,8 +222,8 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:360px;
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/bootstrapValidator.min.js"></script> <script src="/static/js/bootstrapValidator.min.js"></script>
<script src="/static/js/custom.js?v=1002"></script> <script src="/static/js/custom.js?v=1002"></script>
<script> <script>

View File

@ -33,8 +33,8 @@ tbody tr>td:nth-child(2){overflow: hidden;text-overflow: ellipsis;white-space: n
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){

View File

@ -27,8 +27,8 @@
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){

View File

@ -109,8 +109,8 @@
{/block} {/block}
{block name="script"} {block name="script"}
<script src="{$cdnpublic}layer/3.1.1/layer.js"></script> <script src="{$cdnpublic}layer/3.1.1/layer.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/bootstrap-table.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/bootstrap-table.min.js"></script>
<script src="{$cdnpublic}bootstrap-table/1.20.2/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script> <script src="{$cdnpublic}bootstrap-table/1.21.4/extensions/page-jump-to/bootstrap-table-page-jump-to.min.js"></script>
<script src="{$cdnpublic}select2/4.0.13/js/select2.min.js"></script> <script src="{$cdnpublic}select2/4.0.13/js/select2.min.js"></script>
<script src="{$cdnpublic}select2/4.0.13/js/i18n/zh-CN.min.js"></script> <script src="{$cdnpublic}select2/4.0.13/js/i18n/zh-CN.min.js"></script>
<script src="/static/js/custom.js"></script> <script src="/static/js/custom.js"></script>