作者 刘锟

update

@@ -35,7 +35,7 @@ class Temp extends Command @@ -35,7 +35,7 @@ class Temp extends Command
35 35
36 public function handle() 36 public function handle()
37 { 37 {
38 - $this->domain_rewrite_https(); 38 + $this->change_cname_projects_240();
39 } 39 }
40 40
41 /** 41 /**
@@ -119,6 +119,7 @@ class Temp extends Command @@ -119,6 +119,7 @@ class Temp extends Command
119 $project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get(); 119 $project_list = Project::select(['id', 'serve_id'])->whereIn('serve_id', $server_ip_ids)->get();
120 120
121 $domain_model = new DomainInfo(); 121 $domain_model = new DomainInfo();
  122 + $notify_model = new Notify();
122 foreach ($project_list as $value) { 123 foreach ($project_list as $value) {
123 $project_id = $value->id; 124 $project_id = $value->id;
124 125
@@ -142,7 +143,7 @@ class Temp extends Command @@ -142,7 +143,7 @@ class Temp extends Command
142 } 143 }
143 144
144 //创建主站建站任务 145 //创建主站建站任务
145 - $task_info = DomainCreateTask::where('type', 1)->where('server_id', 20)->where('project_id', $project_id)->first(); 146 + $task_info = DomainCreateTask::where('type', 1)->where('server_id', 20)->where('project_id', $project_id)->where('status', '!=', DomainCreateTask::STATUS_SUC)->first();
146 if (!$task_info) { 147 if (!$task_info) {
147 $task_model = new DomainCreateTask(); 148 $task_model = new DomainCreateTask();
148 $task_model->type = 1; 149 $task_model->type = 1;
@@ -152,6 +153,38 @@ class Temp extends Command @@ -152,6 +153,38 @@ class Temp extends Command
152 $task_model->certs = json_encode(['key' => $ssl_info->private_key, 'csr' => $ssl_info->private_cert]); 153 $task_model->certs = json_encode(['key' => $ssl_info->private_key, 'csr' => $ssl_info->private_cert]);
153 $task_model->save(); 154 $task_model->save();
154 } 155 }
  156 +
  157 + //创建主站页面生成任务
  158 + $notify_data = [
  159 + 'project_id' => $project_id,
  160 + 'type' => 1,
  161 + 'route' => 1,
  162 + 'server_id' => 20,
  163 + 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP]
  164 + ];
  165 + $notify = $notify_model->read($notify_data, ['id']);
  166 +
  167 + if (!$notify) {
  168 + $notify_data['data'] = Arr::a2s(['domain' => $domain, 'url' => null, 'language' => []]);
  169 + $notify_data['status'] = Notify::STATUS_INIT;
  170 + $notify_model->add($notify_data);
  171 + }
  172 +
  173 + //创建主站关键词页面生成任务
  174 + $notify_keyword_data = [
  175 + 'project_id' => $project_id,
  176 + 'type' => 1,
  177 + 'route' => 4,
  178 + 'server_id' => 20,
  179 + 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP]
  180 + ];
  181 + $notify_keyword = $notify_model->read($notify_keyword_data, ['id']);
  182 +
  183 + if (!$notify_keyword) {
  184 + $notify_keyword_data['data'] = Arr::a2s(['domain' => $domain, 'url' => null, 'language' => []]);
  185 + $notify_keyword_data['status'] = Notify::STATUS_INIT;
  186 + $notify_model->add($notify_keyword_data);
  187 + }
155 } 188 }
156 189
157 if ($domain_info['amp_status'] == 1) { 190 if ($domain_info['amp_status'] == 1) {
@@ -177,7 +210,7 @@ class Temp extends Command @@ -177,7 +210,7 @@ class Temp extends Command
177 } 210 }
178 211
179 //创建amp站建站任务 212 //创建amp站建站任务
180 - $task_info_amp = DomainCreateTask::where('type', 2)->where('server_id', 20)->where('project_id', $project_id)->first(); 213 + $task_info_amp = DomainCreateTask::where('type', 2)->where('server_id', 20)->where('project_id', $project_id)->where('status', '!=', DomainCreateTask::STATUS_SUC)->first();
181 if (!$task_info_amp) { 214 if (!$task_info_amp) {
182 $task_model = new DomainCreateTask(); 215 $task_model = new DomainCreateTask();
183 $task_model->type = 2; 216 $task_model->type = 2;
@@ -187,6 +220,22 @@ class Temp extends Command @@ -187,6 +220,22 @@ class Temp extends Command
187 $task_model->certs = json_encode(['key' => $ssl_info_amp->private_key, 'csr' => $ssl_info_amp->private_cert]); 220 $task_model->certs = json_encode(['key' => $ssl_info_amp->private_key, 'csr' => $ssl_info_amp->private_cert]);
188 $task_model->save(); 221 $task_model->save();
189 } 222 }
  223 +
  224 + //创建amp站页面生成任务
  225 + $notify_amp_data = [
  226 + 'project_id' => $project_id,
  227 + 'type' => 3,
  228 + 'route' => 1,
  229 + 'server_id' => 20,
  230 + 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP]
  231 + ];
  232 + $notify_amp = $notify_model->read($notify_amp_data, ['id']);
  233 +
  234 + if (!$notify_amp) {
  235 + $notify_amp_data['data'] = Arr::a2s(['domain' => $amp_domain, 'url' => null, 'language' => []]);
  236 + $notify_amp_data['status'] = Notify::STATUS_INIT;
  237 + $notify_model->add($notify_amp_data);
  238 + }
190 } 239 }
191 } 240 }
192 } 241 }