|
...
|
...
|
@@ -6,6 +6,7 @@ namespace App\Http\Logic\Aside\Domain; |
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Devops\ServerConfig;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Project\CountryCustom;
|
|
|
|
use App\Models\Project\DeployOptimize;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Utils\HttpUtils;
|
|
...
|
...
|
@@ -350,4 +351,43 @@ class DomainInfoLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function country_custom(){
|
|
|
|
$project_model = new Project();
|
|
|
|
$project_info = $project_model->read(['id'=>$this->param['project_id']],'serve_id');
|
|
|
|
if($project_info === false){
|
|
|
|
$this->fail('获取项目数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->param['is_create']){
|
|
|
|
//需要创建站点
|
|
|
|
$server_model = new ServerConfig();
|
|
|
|
$server_info = $server_model->read(['id'=>$project_info['serve_id']],['init_domain', 'host']);
|
|
|
|
if($server_info === false){
|
|
|
|
$this->fail('获取服务器数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
//域名是否都已经解析
|
|
|
|
if(!$this->check_cname($this->param['custom_domain'], $server_info)){
|
|
|
|
$this->fail('域名' . $this->param['custom_domain'] . '未解析至目标服务器');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$custom_model = new CountryCustom();
|
|
|
|
$info = $custom_model->read(['project_id',$this->user['project_id'],'language_id'=>$this->param['language_id']]);
|
|
|
|
if($info === false){
|
|
|
|
$custom_model->add($this->param);
|
|
|
|
}else{
|
|
|
|
$custom_model->edit($this->param,['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->param['is_create']){
|
|
|
|
//创建站点,设置证书
|
|
|
|
$this->param['key'] = $this->param['private_key'] ?? '';
|
|
|
|
$this->param['cert'] = $this->param['private_cert'] ?? '';
|
|
|
|
$this->setDomainSsl($server_info['init_domain'],$this->param['custom_domain'],[],[],0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|