作者 赵彬吉

update

@@ -152,8 +152,6 @@ class UpdateSeoTdk extends Command @@ -152,8 +152,6 @@ class UpdateSeoTdk extends Command
152 try { 152 try {
153 $this->project = ProjectServer::useProject($project_id); 153 $this->project = ProjectServer::useProject($project_id);
154 $this->seo_tdk($project_id, $task->id); 154 $this->seo_tdk($project_id, $task->id);
155 - //TODO::通知C端更新所有界面  
156 - $this->sendNotify($project_id);  
157 DB::disconnect('custom_mysql'); 155 DB::disconnect('custom_mysql');
158 }catch (\Exception $e){ 156 }catch (\Exception $e){
159 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL; 157 echo date('Y-m-d H:i:s') . 'line: '. $e->getLine() .' error: ' . $project_id . '->' . $e->getMessage() . PHP_EOL;
@@ -163,7 +161,7 @@ class UpdateSeoTdk extends Command @@ -163,7 +161,7 @@ class UpdateSeoTdk extends Command
163 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL; 161 echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL;
164 } 162 }
165 } 163 }
166 - public function sendNotify($project_id) 164 + public function sendNotify($project_id, $route)
167 { 165 {
168 //获取当前项目的域名 166 //获取当前项目的域名
169 $domainModel = new DomainInfo(); 167 $domainModel = new DomainInfo();
@@ -180,7 +178,7 @@ class UpdateSeoTdk extends Command @@ -180,7 +178,7 @@ class UpdateSeoTdk extends Command
180 $param = [ 178 $param = [
181 'project_id' => $project_id, 179 'project_id' => $project_id,
182 'type' => 1, 180 'type' => 1,
183 - 'route' => 1, 181 + 'route' => $route,
184 'url' => [], 182 'url' => [],
185 'language'=> [], 183 'language'=> [],
186 ]; 184 ];
@@ -189,7 +187,7 @@ class UpdateSeoTdk extends Command @@ -189,7 +187,7 @@ class UpdateSeoTdk extends Command
189 } 187 }
190 public function seo_tdk($project_id, $task_id) 188 public function seo_tdk($project_id, $task_id)
191 { 189 {
192 - 190 + $notify_master = $notify_keyword = false;
193 //更新统计 191 //更新统计
194 $update = []; 192 $update = [];
195 $ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray(); 193 $ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray();
@@ -329,10 +327,19 @@ class UpdateSeoTdk extends Command @@ -329,10 +327,19 @@ class UpdateSeoTdk extends Command
329 $data[$json_field] = json_encode($data[$json_field]); 327 $data[$json_field] = json_encode($data[$json_field]);
330 } 328 }
331 DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data); 329 DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data);
  330 + if($table == 'gl_product_keyword'){
  331 + $notify_keyword = true;
  332 + }else{
  333 + $notify_master = true;
  334 + }
332 } 335 }
333 } 336 }
334 } 337 }
335 ProjectUpdateTdk::finish($task_id, $update); 338 ProjectUpdateTdk::finish($task_id, $update);
  339 +
  340 + //通知C端更新界面
  341 + $notify_master && $this->sendNotify($project_id, 1); //通知主站更新
  342 + $notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新
336 } 343 }
337 344
338 public function getPrompt($project_id, $prompt, $table, $data){ 345 public function getPrompt($project_id, $prompt, $table, $data){