作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -23,7 +23,7 @@ class UpgradeCount extends Command
*
* @var string
*/
protected $signature = 'upgrade_count';
protected $signature = 'upgrade_counts';
/**
* The console command description.
... ... @@ -34,7 +34,7 @@ class UpgradeCount extends Command
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0,'id'=>['<=',550]]);
$list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]);
foreach ($list as $v) {
echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
... ...
... ... @@ -55,6 +55,9 @@ class UpgradeProjectCount extends Command
$arr = [];
foreach ($list as $k=>$v){
$v = (array)$v;
if($v['updated_date'] == date('Y-m-d')){
continue;
}
echo date('Y-m-d H:i:s') . '时间:'.$v['updated_date'] . PHP_EOL;
$count = new Count();
$arr['project_id'] = $project_id;
... ...
... ... @@ -27,7 +27,7 @@ class UpgradeCount extends Command
*
* @var string
*/
protected $signature = 'upgrade_month_count';
protected $signature = 'upgrade_month_counts';
/**
* The console command description.
... ... @@ -38,7 +38,7 @@ class UpgradeCount extends Command
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0,'id'=>['<=',456]]);
$list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]);
foreach ($list as $v) {
$oldModel = new UpdateOldInfo();
$info = $oldModel->read(['project_id' => $v['id']]);
... ...
... ... @@ -65,6 +65,9 @@ class UpgradeProjectCount extends Command
->groupBy('month')->get()->toArray();
foreach ($list as $k=>$v){
$v = (array)$v;
if($v['month'] == date('Y-m')){
continue;
}
$monthCountModel = new MonthCount();
$info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
// 获取当月开始时间
... ...
... ... @@ -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){
... ...