作者 刘锟

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

@@ -23,7 +23,7 @@ class UpgradeCount extends Command @@ -23,7 +23,7 @@ class UpgradeCount extends Command
23 * 23 *
24 * @var string 24 * @var string
25 */ 25 */
26 - protected $signature = 'upgrade_count'; 26 + protected $signature = 'upgrade_counts';
27 27
28 /** 28 /**
29 * The console command description. 29 * The console command description.
@@ -34,7 +34,7 @@ class UpgradeCount extends Command @@ -34,7 +34,7 @@ class UpgradeCount extends Command
34 34
35 public function handle(){ 35 public function handle(){
36 $projectModel = new Project(); 36 $projectModel = new Project();
37 - $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0,'id'=>['<=',550]]); 37 + $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]);
38 foreach ($list as $v) { 38 foreach ($list as $v) {
39 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; 39 echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL;
40 ProjectServer::useProject($v['id']); 40 ProjectServer::useProject($v['id']);
@@ -55,6 +55,9 @@ class UpgradeProjectCount extends Command @@ -55,6 +55,9 @@ class UpgradeProjectCount extends Command
55 $arr = []; 55 $arr = [];
56 foreach ($list as $k=>$v){ 56 foreach ($list as $k=>$v){
57 $v = (array)$v; 57 $v = (array)$v;
  58 + if($v['updated_date'] == date('Y-m-d')){
  59 + continue;
  60 + }
58 echo date('Y-m-d H:i:s') . '时间:'.$v['updated_date'] . PHP_EOL; 61 echo date('Y-m-d H:i:s') . '时间:'.$v['updated_date'] . PHP_EOL;
59 $count = new Count(); 62 $count = new Count();
60 $arr['project_id'] = $project_id; 63 $arr['project_id'] = $project_id;
@@ -27,7 +27,7 @@ class UpgradeCount extends Command @@ -27,7 +27,7 @@ class UpgradeCount extends Command
27 * 27 *
28 * @var string 28 * @var string
29 */ 29 */
30 - protected $signature = 'upgrade_month_count'; 30 + protected $signature = 'upgrade_month_counts';
31 31
32 /** 32 /**
33 * The console command description. 33 * The console command description.
@@ -38,7 +38,7 @@ class UpgradeCount extends Command @@ -38,7 +38,7 @@ class UpgradeCount extends Command
38 38
39 public function handle(){ 39 public function handle(){
40 $projectModel = new Project(); 40 $projectModel = new Project();
41 - $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0,'id'=>['<=',456]]); 41 + $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]);
42 foreach ($list as $v) { 42 foreach ($list as $v) {
43 $oldModel = new UpdateOldInfo(); 43 $oldModel = new UpdateOldInfo();
44 $info = $oldModel->read(['project_id' => $v['id']]); 44 $info = $oldModel->read(['project_id' => $v['id']]);
@@ -65,6 +65,9 @@ class UpgradeProjectCount extends Command @@ -65,6 +65,9 @@ class UpgradeProjectCount extends Command
65 ->groupBy('month')->get()->toArray(); 65 ->groupBy('month')->get()->toArray();
66 foreach ($list as $k=>$v){ 66 foreach ($list as $k=>$v){
67 $v = (array)$v; 67 $v = (array)$v;
  68 + if($v['month'] == date('Y-m')){
  69 + continue;
  70 + }
68 $monthCountModel = new MonthCount(); 71 $monthCountModel = new MonthCount();
69 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]); 72 $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]);
70 // 获取当月开始时间 73 // 获取当月开始时间
@@ -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){