|
...
|
...
|
@@ -4,9 +4,11 @@ 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\DeployOptimize;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Utils\HttpUtils;
|
|
|
|
use GuzzleHttp\Client;
|
|
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
...
|
...
|
@@ -143,8 +145,65 @@ class DomainInfoLogic extends BaseLogic |
|
|
|
return $this->success($info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 编辑网站证书
|
|
|
|
* @return array
|
|
|
|
* @throws \App\Exceptions\AsideGlobalException
|
|
|
|
* @throws \App\Exceptions\BsideGlobalException
|
|
|
|
* @author Akun
|
|
|
|
* @date 2023/10/17 11:52
|
|
|
|
*/
|
|
|
|
public function setDomainSsl()
|
|
|
|
{
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('当前数据不存在或者已被删除');
|
|
|
|
}
|
|
|
|
|
|
|
|
$project_model = new Project();
|
|
|
|
$project_info = $project_model->read(['id',$info['project_id']],'serve_id');
|
|
|
|
if($project_info === false){
|
|
|
|
$this->fail('获取项目数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
$server_model = new ServerConfig();
|
|
|
|
$server_info = $server_model->read(['id',$project_info['serve_id']],'init_domain');
|
|
|
|
if($server_info === false){
|
|
|
|
$this->fail('获取服务器数据失败');
|
|
|
|
}
|
|
|
|
|
|
|
|
if($this->param['type'] == 2){
|
|
|
|
if(empty($this->param['key'])){
|
|
|
|
$this->fail('证书KEY值不能为空');
|
|
|
|
}
|
|
|
|
if(empty($this->param['cert'])){
|
|
|
|
$this->fail('证书cert值不能为空');
|
|
|
|
}
|
|
|
|
|
|
|
|
// $api_url = 'http://'.$server_info['init_domain'].'/setSsl';
|
|
|
|
$api_url = 'http://master2.globalso.com/api/setSsl';
|
|
|
|
$api_param = [
|
|
|
|
'domain' => $info['domain'],
|
|
|
|
'private_key' => $this->param['key'],
|
|
|
|
'cert' => $this->param['cert'],
|
|
|
|
];
|
|
|
|
}else{
|
|
|
|
// $api_url = 'http://'.$server_info['init_domain'].'/applySsl';
|
|
|
|
$api_url = 'http://master2.globalso.com/api/applySsl';
|
|
|
|
$api_param = ['domain' => $info['domain']];
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
$rs = HttpUtils::get($api_url, $api_param);
|
|
|
|
if(isset($rs['status']) && $rs['status'] == 200){
|
|
|
|
return $this->success();
|
|
|
|
}else{
|
|
|
|
$this->fail($rs['message']??'');
|
|
|
|
}
|
|
|
|
} catch (\Exception | GuzzleException $e) {
|
|
|
|
errorLog('创建站点', $api_param, $e);
|
|
|
|
$this->fail('编辑证书失败');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|