作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !2420
... ... @@ -822,7 +822,7 @@ if(!function_exists('curlGet')){
*/
function curlGet($url){
$ch1 = curl_init();
$timeout = 0;
$timeout = 60;
curl_setopt($ch1, CURLOPT_URL, $url);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch1, CURLOPT_ENCODING, '');
... ... @@ -1077,17 +1077,31 @@ if (!function_exists('check_domain_record')) {
function check_domain_record($domain, $server_info)
{
try {
$is_record = false;
//获取域名解析记录
$records = dns_get_record($domain,DNS_A);
if(count($records) != 1){
return false;
if(count($records) == 1 && ($records[0]['host'] == $server_info['domain'] || $records[0]['ip'] == $server_info['ip'])){
$is_record = true;
}
$record = $records[0];
if($record['host'] == $server_info['domain'] || $record['ip'] == $server_info['ip']){
return $domain;
}else{
return false;
if(!$is_record){
//解析不正确,再判断是否开启cnd
$cnd = curlGet('http://sitebak.globalso.com/get_records?domain=' . $domain);
if (isset($cnd['data']) && $cnd['data']) {
foreach ($cnd['data'] as $vc) {
if ($vc['type'] == 'A' && $vc['content'] == $server_info['ip']) {
$is_record = true;
break;
}elseif ($vc['type'] == 'CNAME' && $vc['content'] == $server_info['domain']){
$is_record = true;
break;
}
}
}
}
return $is_record;
}catch (\Exception $e){
errorLog('dns_get_record',['domain'=>$domain],$e);
return false;
... ... @@ -1373,3 +1387,4 @@ function analysisRoute($pathInfo)
}
return $router;
}
... ...