作者 刘锟

小语种自定义跳转域名

@@ -375,16 +375,21 @@ class DomainInfoLogic extends BaseLogic @@ -375,16 +375,21 @@ class DomainInfoLogic extends BaseLogic
375 } 375 }
376 376
377 //域名是否都已经解析 377 //域名是否都已经解析
378 - if(empty($this->param['custom_domain'])){  
379 - $this->fail('自定义跳转域名不能为空'); 378 + if(strpos($this->param['custom_domain'],'//') === false){
  379 + $this->param['custom_domain'] = '//'.$this->param['custom_domain'];
380 } 380 }
381 - if(strpos($this->param['custom_domain'],'http') !== false){  
382 - $domain_arr = parse_url($this->param['custom_domain']);  
383 - $this->param['custom_domain'] = $domain_arr['host']; 381 + $domain_arr = parse_url($this->param['custom_domain']);
  382 + if(!isset($domain_arr['host'])){
  383 + $this->fail('自定义域名填写错误');
384 } 384 }
  385 + $this->param['custom_domain'] = $domain_arr['host'];
385 if(!$this->check_cname($this->param['custom_domain'], $server_info)){ 386 if(!$this->check_cname($this->param['custom_domain'], $server_info)){
386 $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器'); 387 $this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器');
387 } 388 }
  389 + }else{
  390 + $this->param['custom_domain'] = str_replace('https://','',$this->param['custom_domain']);
  391 + $this->param['custom_domain'] = str_replace('http://','',$this->param['custom_domain']);
  392 + $this->param['custom_domain'] = str_replace('//','',$this->param['custom_domain']);
388 } 393 }
389 394
390 $custom_model = new CountryCustom(); 395 $custom_model = new CountryCustom();