Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
1 个修改的文件
包含
52 行增加
和
0 行删除
| @@ -189,6 +189,48 @@ class DomainInfoLogic extends BaseLogic | @@ -189,6 +189,48 @@ class DomainInfoLogic extends BaseLogic | ||
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | /** | 191 | /** |
| 192 | + * 编辑amp网站证书 | ||
| 193 | + * @param $initDomain | ||
| 194 | + * @param $domain | ||
| 195 | + * @return array | ||
| 196 | + * @throws \App\Exceptions\AsideGlobalException | ||
| 197 | + * @throws \App\Exceptions\BsideGlobalException | ||
| 198 | + * @author Akun | ||
| 199 | + * @date 2024/02/22 14:58 | ||
| 200 | + */ | ||
| 201 | + public function setAmpDomainSsl($initDomain,$domain) | ||
| 202 | + { | ||
| 203 | + if($this->param['amp_type'] == 2){ | ||
| 204 | + if(empty($this->param['amp_key'])){ | ||
| 205 | + $this->fail('AMP站点证书KEY值不能为空'); | ||
| 206 | + } | ||
| 207 | + if(empty($this->param['amp_cert'])){ | ||
| 208 | + $this->fail('AMP站点证书cert值不能为空'); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + $api_url = 'http://'.$initDomain.'/api/createSiteAmp'; | ||
| 212 | + $api_param = [ | ||
| 213 | + 'domain' => $domain, | ||
| 214 | + 'private_key' => $this->param['amp_key']??'', | ||
| 215 | + 'cert' => $this->param['amp_cert']??'' | ||
| 216 | + ]; | ||
| 217 | + | ||
| 218 | + try { | ||
| 219 | + $rs = HttpUtils::get($api_url, $api_param); | ||
| 220 | + $rs = json_decode($rs, true); | ||
| 221 | + if(isset($rs['status']) && $rs['status'] == 200){ | ||
| 222 | + return $this->success(); | ||
| 223 | + }else{ | ||
| 224 | + $this->fail($rs['message']??''); | ||
| 225 | + } | ||
| 226 | + } catch (\Exception | GuzzleException $e) { | ||
| 227 | + errorLog('创建AMP站点', $api_param, $e); | ||
| 228 | + $this->fail('编辑AMP站点证书失败'); | ||
| 229 | + } | ||
| 230 | + return $this->success(); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 192 | * @remark :保存证书相关配置 | 234 | * @remark :保存证书相关配置 |
| 193 | * @name :sslSave | 235 | * @name :sslSave |
| 194 | * @author :lyh | 236 | * @author :lyh |
| @@ -229,10 +271,20 @@ class DomainInfoLogic extends BaseLogic | @@ -229,10 +271,20 @@ class DomainInfoLogic extends BaseLogic | ||
| 229 | 'type'=>$this->param['type'], | 271 | 'type'=>$this->param['type'], |
| 230 | 'private_key' => $this->param['key'] ?? '', | 272 | 'private_key' => $this->param['key'] ?? '', |
| 231 | 'private_cert' => $this->param['cert'] ?? '', | 273 | 'private_cert' => $this->param['cert'] ?? '', |
| 274 | + 'amp_status' => $this->param['amp_status'] ?? 0, | ||
| 275 | + 'amp_type' => $this->param['amp_type'] ?? 0, | ||
| 276 | + 'amp_private_key' => $this->param['amp_key'] ?? '', | ||
| 277 | + 'amp_private_cert' => $this->param['amp_cert'] ?? '', | ||
| 232 | ]; | 278 | ]; |
| 233 | $this->model->edit($data,['id'=>$this->param['id']]); | 279 | $this->model->edit($data,['id'=>$this->param['id']]); |
| 234 | //生成证书 | 280 | //生成证书 |
| 235 | $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []); | 281 | $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? []); |
| 282 | + | ||
| 283 | + //amp站点生成证书 | ||
| 284 | + if($data['amp_status']){ | ||
| 285 | + $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']); | ||
| 286 | + } | ||
| 287 | + | ||
| 236 | return $this->success(); | 288 | return $this->success(); |
| 237 | } | 289 | } |
| 238 | 290 |
-
请 注册 或 登录 后发表评论