|
...
|
...
|
@@ -189,6 +189,48 @@ class DomainInfoLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 编辑amp网站证书
|
|
|
|
* @param $initDomain
|
|
|
|
* @param $domain
|
|
|
|
* @return array
|
|
|
|
* @throws \App\Exceptions\AsideGlobalException
|
|
|
|
* @throws \App\Exceptions\BsideGlobalException
|
|
|
|
* @author Akun
|
|
|
|
* @date 2024/02/22 14:58
|
|
|
|
*/
|
|
|
|
public function setAmpDomainSsl($initDomain,$domain)
|
|
|
|
{
|
|
|
|
if($this->param['amp_type'] == 2){
|
|
|
|
if(empty($this->param['amp_key'])){
|
|
|
|
$this->fail('AMP站点证书KEY值不能为空');
|
|
|
|
}
|
|
|
|
if(empty($this->param['amp_cert'])){
|
|
|
|
$this->fail('AMP站点证书cert值不能为空');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$api_url = 'http://'.$initDomain.'/api/createSiteAmp';
|
|
|
|
$api_param = [
|
|
|
|
'domain' => $domain,
|
|
|
|
'private_key' => $this->param['amp_key']??'',
|
|
|
|
'cert' => $this->param['amp_cert']??''
|
|
|
|
];
|
|
|
|
|
|
|
|
try {
|
|
|
|
$rs = HttpUtils::get($api_url, $api_param);
|
|
|
|
$rs = json_decode($rs, true);
|
|
|
|
if(isset($rs['status']) && $rs['status'] == 200){
|
|
|
|
return $this->success();
|
|
|
|
}else{
|
|
|
|
$this->fail($rs['message']??'');
|
|
|
|
}
|
|
|
|
} catch (\Exception | GuzzleException $e) {
|
|
|
|
errorLog('创建AMP站点', $api_param, $e);
|
|
|
|
$this->fail('编辑AMP站点证书失败');
|
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存证书相关配置
|
|
|
|
* @name :sslSave
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -229,10 +271,20 @@ class DomainInfoLogic extends BaseLogic |
|
|
|
'type'=>$this->param['type'],
|
|
|
|
'private_key' => $this->param['key'] ?? '',
|
|
|
|
'private_cert' => $this->param['cert'] ?? '',
|
|
|
|
'amp_status' => $this->param['amp_status'] ?? 0,
|
|
|
|
'amp_type' => $this->param['amp_type'] ?? 0,
|
|
|
|
'amp_private_key' => $this->param['amp_key'] ?? '',
|
|
|
|
'amp_private_cert' => $this->param['amp_cert'] ?? '',
|
|
|
|
];
|
|
|
|
$this->model->edit($data,['id'=>$this->param['id']]);
|
|
|
|
//生成证书
|
|
|
|
$this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []);
|
|
|
|
|
|
|
|
//amp站点生成证书
|
|
|
|
if($data['amp_status']){
|
|
|
|
$this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|