作者 赵彬吉

update

@@ -43,6 +43,7 @@ class RankData extends BaseCommands @@ -43,6 +43,7 @@ class RankData extends BaseCommands
43 */ 43 */
44 public function do() 44 public function do()
45 { 45 {
  46 + Log::channel('rank_data')->info('开始-排名数据');
46 //同步api_no 47 //同步api_no
47 $this->SyncApiNo(); 48 $this->SyncApiNo();
48 49
@@ -427,9 +427,8 @@ class RankDataLogic extends BaseLogic @@ -427,9 +427,8 @@ class RankDataLogic extends BaseLogic
427 427
428 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0; 428 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
429 429
430 - if(!$lang){  
431 - foreach ($data as &$ranks){  
432 - ksort($ranks); 430 + foreach ($data as &$ranks){
  431 + ksort($ranks);
433 // foreach ($ranks as &$rank){ 432 // foreach ($ranks as &$rank){
434 // //处理排名 433 // //处理排名
435 // if(!in_array($project_id, $without_project_ids)){ 434 // if(!in_array($project_id, $without_project_ids)){
@@ -439,30 +438,30 @@ class RankDataLogic extends BaseLogic @@ -439,30 +438,30 @@ class RankDataLogic extends BaseLogic
439 // //todo 需要特殊处理排名的项目 438 // //todo 需要特殊处理排名的项目
440 // } 439 // }
441 // } 440 // }
442 - $last = Arr::last($ranks);  
443 - //第一名  
444 - if($last['position'] == 1){  
445 - $first_num ++;  
446 - }  
447 - //排名第一页  
448 - if($last['position'] > 0 && $last['position'] <= 10){  
449 - $first_page_num ++;  
450 - }  
451 - //排名前三页  
452 - if($last['position'] > 0 && $last['position'] <= 30){  
453 - $first_three_pages_num ++;  
454 - }  
455 - //排名前五页  
456 - if($last['position'] > 0 && $last['position'] <= 50){  
457 - $first_five_pages_num ++;  
458 - }  
459 - //排名前十页  
460 - if($last['position'] > 0 && $last['position'] <= 100){  
461 - $first_ten_pages_num ++;  
462 - } 441 + $last = Arr::last($ranks);
  442 + //第一名
  443 + if($last['position'] == 1){
  444 + $first_num ++;
  445 + }
  446 + //排名第一页
  447 + if($last['position'] > 0 && $last['position'] <= 10){
  448 + $first_page_num ++;
  449 + }
  450 + //排名前三页
  451 + if($last['position'] > 0 && $last['position'] <= 30){
  452 + $first_three_pages_num ++;
  453 + }
  454 + //排名前五页
  455 + if($last['position'] > 0 && $last['position'] <= 50){
  456 + $first_five_pages_num ++;
  457 + }
  458 + //排名前十页
  459 + if($last['position'] > 0 && $last['position'] <= 100){
  460 + $first_ten_pages_num ++;
463 } 461 }
464 } 462 }
465 463
  464 +
466 $where = [ 465 $where = [
467 'project_id' => $project_id, 466 'project_id' => $project_id,
468 'lang' => $lang 467 'lang' => $lang
@@ -479,6 +478,7 @@ class RankDataLogic extends BaseLogic @@ -479,6 +478,7 @@ class RankDataLogic extends BaseLogic
479 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); 478 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
480 $type = Project::where('id', $project_id)->value('type'); 479 $type = Project::where('id', $project_id)->value('type');
481 if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){ 480 if($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num){
  481 + Log::channel('rank_data')->info('项目'.$project_id.':关键词达标-'.$first_page_num);
482 $model->compliance_day = $model->compliance_day + 1; 482 $model->compliance_day = $model->compliance_day + 1;
483 $model->is_compliance = 1; 483 $model->is_compliance = 1;
484 //项目表更新 484 //项目表更新
@@ -486,6 +486,8 @@ class RankDataLogic extends BaseLogic @@ -486,6 +486,8 @@ class RankDataLogic extends BaseLogic
486 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0; 486 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
487 Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]); 487 Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day+1]);
488 } 488 }
  489 + }else{
  490 + Log::channel('rank_data')->info('项目'.$project_id.':关键词未达标-'.$first_page_num);
489 } 491 }
490 } 492 }
491 $model->project_id = $project_id; 493 $model->project_id = $project_id;