作者 赵彬吉

update

... ... @@ -152,8 +152,6 @@ class UpdateSeoTdk extends Command
try {
$this->project = ProjectServer::useProject($project_id);
$this->seo_tdk($project_id, $task->id);
//TODO::通知C端更新所有界面
$this->sendNotify($project_id);
DB::disconnect('custom_mysql');
}catch (\Exception $e){
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
echo date('Y-m-d H:i:s') . ' end project_id: ' . $project_id . PHP_EOL;
}
}
public function sendNotify($project_id)
public function sendNotify($project_id, $route)
{
//获取当前项目的域名
$domainModel = new DomainInfo();
... ... @@ -180,7 +178,7 @@ class UpdateSeoTdk extends Command
$param = [
'project_id' => $project_id,
'type' => 1,
'route' => 1,
'route' => $route,
'url' => [],
'language'=> [],
];
... ... @@ -189,7 +187,7 @@ class UpdateSeoTdk extends Command
}
public function seo_tdk($project_id, $task_id)
{
$notify_master = $notify_keyword = false;
//更新统计
$update = [];
$ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray();
... ... @@ -329,10 +327,19 @@ class UpdateSeoTdk extends Command
$data[$json_field] = json_encode($data[$json_field]);
}
DB::connection('custom_mysql')->table($table)->where(['id' => $v['id']])->update($data);
if($table == 'gl_product_keyword'){
$notify_keyword = true;
}else{
$notify_master = true;
}
}
}
}
ProjectUpdateTdk::finish($task_id, $update);
//通知C端更新界面
$notify_master && $this->sendNotify($project_id, 1); //通知主站更新
$notify_keyword && $this->sendNotify($project_id, 4); //通知聚合页更新
}
public function getPrompt($project_id, $prompt, $table, $data){
... ...