作者 lyh

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6

... ... @@ -38,27 +38,25 @@ class EditCustomDomainBt implements ShouldQueue
*/
public function handle()
{
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('生成证书---开始', true) . PHP_EOL, FILE_APPEND);
//获取域名数据
$domain_model = new CountryCustom();
$domain_info = $domain_model->read(['id' => $this->domain_id]);
if ($domain_info === false) {
return $this->output($domain_info['custom_domain'] . ':获取域名数据失败');
}
//获取项目数据
$project_model = new Project();
$project_info = $project_model->read(['id' => $domain_info['project_id']], 'serve_id');
if ($project_info === false) {
return $this->output($domain_info['custom_domain'] . ':获取项目数据失败');
}
//获取服务器数据
$server_model = new ServerConfig();
$server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);
if ($server_info === false) {
return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败');
}
//编辑站点
if ($domain_info['type'] == 2) {
$api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl';
... ... @@ -70,6 +68,7 @@ class EditCustomDomainBt implements ShouldQueue
'other_domain' => [],
'is_https' => 1
];
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('生成证书--参数:'.json_encode($api_param), true) . PHP_EOL, FILE_APPEND);
} else {
$api_url = 'http://' . $server_info['init_domain'] . '/api/applySsl';
$api_param = [
... ... @@ -78,9 +77,11 @@ class EditCustomDomainBt implements ShouldQueue
'other_domain' => [],
'is_https' => 1
];
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('生成证书--参数:'.json_encode($api_param), true) . PHP_EOL, FILE_APPEND);
}
try {
$rs = HttpUtils::get($api_url, $api_param);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('请求接口返回数据:'.$rs, true) . PHP_EOL, FILE_APPEND);
$rs = json_decode($rs, true);
if (isset($rs['status']) && $rs['status'] == 200) {
$this->output($domain_info['custom_domain'] . ':站点编辑成功');
... ... @@ -88,6 +89,7 @@ class EditCustomDomainBt implements ShouldQueue
$this->output($domain_info['custom_domain'] . ':站点编辑失败,原因:' . ($rs['message'] ?? ''));
}
} catch (\Exception | GuzzleException $e) {
@file_put_contents(storage_path('logs/lyh_error.log'), var_export('错误情况打印:'.$rs, true) . PHP_EOL, FILE_APPEND);
$this->output($domain_info['custom_domain'] . ':站点编辑失败,原因:' . $e->getMessage());
}
... ...