作者 刘锟

update

@@ -35,7 +35,7 @@ class CreateSite extends Command @@ -35,7 +35,7 @@ class CreateSite extends Command
35 if ($task) { 35 if ($task) {
36 $model->edit(['status' => DomainCreateTask::STATUS_ING], ['id' => $task['id']]); 36 $model->edit(['status' => DomainCreateTask::STATUS_ING], ['id' => $task['id']]);
37 37
38 - $re = $this->editDomainBt($task['domain_id']); 38 + $re = $this->editDomainBt($task['domain_id'], $task['type']);
39 39
40 if (is_array($re)) { 40 if (is_array($re)) {
41 $model->edit(['status' => DomainCreateTask::STATUS_FAL, 'error_msg' => $re[1]], ['id' => $task['id']]); 41 $model->edit(['status' => DomainCreateTask::STATUS_FAL, 'error_msg' => $re[1]], ['id' => $task['id']]);
@@ -45,7 +45,7 @@ class CreateSite extends Command @@ -45,7 +45,7 @@ class CreateSite extends Command
45 } 45 }
46 } 46 }
47 47
48 - protected function editDomainBt($domain_id) 48 + protected function editDomainBt($domain_id, $type)
49 { 49 {
50 //获取域名数据 50 //获取域名数据
51 $domain_model = new DomainInfo(); 51 $domain_model = new DomainInfo();
@@ -73,6 +73,7 @@ class CreateSite extends Command @@ -73,6 +73,7 @@ class CreateSite extends Command
73 return [false, '获取服务器数据失败2']; 73 return [false, '获取服务器数据失败2'];
74 } 74 }
75 75
  76 + if ($type == 1) {
76 /*****************编辑主站*******************/ 77 /*****************编辑主站*******************/
77 if ($domain_info['type'] == 2) { 78 if ($domain_info['type'] == 2) {
78 $api_url = 'http://' . $serverInfo['init_domain'] . '/api/setSsl'; 79 $api_url = 'http://' . $serverInfo['init_domain'] . '/api/setSsl';
@@ -106,12 +107,12 @@ class CreateSite extends Command @@ -106,12 +107,12 @@ class CreateSite extends Command
106 if (isset($rs['status']) && $rs['status'] == 200) { 107 if (isset($rs['status']) && $rs['status'] == 200) {
107 $this->output($domain_info['domain'] . ',主站创建成功'); 108 $this->output($domain_info['domain'] . ',主站创建成功');
108 } else { 109 } else {
109 - return [false, '主站:' . ($rs['message'] ?? '未知错误')]; 110 + return [false, $rs['message'] ?? '未知错误'];
110 } 111 }
111 } catch (\Exception | GuzzleException $e) { 112 } catch (\Exception | GuzzleException $e) {
112 - return [false, '主站:' . $e->getMessage()]; 113 + return [false, $e->getMessage()];
113 } 114 }
114 - 115 + } else {
115 /*****************编辑amp站*******************/ 116 /*****************编辑amp站*******************/
116 if ($domain_info['amp_status']) { 117 if ($domain_info['amp_status']) {
117 $api_url_amp = 'http://' . $serverInfo['init_domain'] . '/api/createSiteAmp'; 118 $api_url_amp = 'http://' . $serverInfo['init_domain'] . '/api/createSiteAmp';
@@ -132,10 +133,11 @@ class CreateSite extends Command @@ -132,10 +133,11 @@ class CreateSite extends Command
132 if (isset($rs_amp['status']) && $rs_amp['status'] == 200) { 133 if (isset($rs_amp['status']) && $rs_amp['status'] == 200) {
133 $this->output($domain_info['domain'] . ',amp站创建成功'); 134 $this->output($domain_info['domain'] . ',amp站创建成功');
134 } else { 135 } else {
135 - return [false, 'amp站:' . ($rs['message'] ?? '未知错误')]; 136 + return [false, $rs['message'] ?? '未知错误'];
136 } 137 }
137 } catch (\Exception | GuzzleException $e_amp) { 138 } catch (\Exception | GuzzleException $e_amp) {
138 - return [false, 'amp站:' . $e_amp->getMessage()]; 139 + return [false, $e_amp->getMessage()];
  140 + }
139 } 141 }
140 } 142 }
141 143