作者 lyh

gx

@@ -91,9 +91,10 @@ class RankData extends BaseCommands @@ -91,9 +91,10 @@ class RankData extends BaseCommands
91 * @date 2023/5/8 91 * @date 2023/5/8
92 */ 92 */
93 public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){ 93 public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
94 - @file_put_contents(storage_path('logs/lyh_error.log'), var_export('44444444444进入', true) . PHP_EOL, FILE_APPEND);  
95 $without_project_ids = []; //不用处理排名的项目 94 $without_project_ids = []; //不用处理排名的项目
  95 +
96 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0; 96 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
  97 +
97 if(!$lang){ 98 if(!$lang){
98 foreach ($data as &$ranks){ 99 foreach ($data as &$ranks){
99 ksort($ranks); 100 ksort($ranks);
@@ -147,6 +148,7 @@ class RankData extends BaseCommands @@ -147,6 +148,7 @@ class RankData extends BaseCommands
147 $model->compliance_day = $model->compliance_day + 1; 148 $model->compliance_day = $model->compliance_day + 1;
148 } 149 }
149 } 150 }
  151 +
150 $model->project_id = $project_id; 152 $model->project_id = $project_id;
151 $model->first_num = $first_num; 153 $model->first_num = $first_num;
152 $model->first_page_num = $first_page_num; 154 $model->first_page_num = $first_page_num;
@@ -157,6 +159,7 @@ class RankData extends BaseCommands @@ -157,6 +159,7 @@ class RankData extends BaseCommands
157 $model->lang = $lang; 159 $model->lang = $lang;
158 $model->data = $data; 160 $model->data = $data;
159 $model->updated_date = date('Y-m-d'); 161 $model->updated_date = date('Y-m-d');
  162 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($model, true) . PHP_EOL, FILE_APPEND);
160 $model->save(); 163 $model->save();
161 } 164 }
162 } 165 }
@@ -38,6 +38,7 @@ class RecommDomain extends BaseCommands @@ -38,6 +38,7 @@ class RecommDomain extends BaseCommands
38 $semrushApi = new SemrushApi(); 38 $semrushApi = new SemrushApi();
39 //有排名api编号的项目 39 //有排名api编号的项目
40 $list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray(); 40 $list = DeployOptimize::where('api_no', '>', 0)->pluck('domain', 'project_id')->toArray();
  41 +
41 foreach ($list as $project_id => $domain) { 42 foreach ($list as $project_id => $domain) {
42 if(!$domain){ 43 if(!$domain){
43 continue; 44 continue;
@@ -49,12 +50,14 @@ class RecommDomain extends BaseCommands @@ -49,12 +50,14 @@ class RecommDomain extends BaseCommands
49 if (!$model) { 50 if (!$model) {
50 $model = new RecommDomainModel(); 51 $model = new RecommDomainModel();
51 } 52 }
  53 +
52 //外链引荐域名 54 //外链引荐域名
53 $data = $semrushApi->backlinks_refdomains($domain); 55 $data = $semrushApi->backlinks_refdomains($domain);
54 if (!$data) { 56 if (!$data) {
55 $error++; 57 $error++;
56 continue; 58 continue;
57 } 59 }
  60 +
58 $model->project_id = $project_id; 61 $model->project_id = $project_id;
59 $model->data = $data; 62 $model->data = $data;
60 $model->updated_date = date('Y-m-d'); 63 $model->updated_date = date('Y-m-d');
@@ -52,4 +52,6 @@ class AiCommandController extends BaseController @@ -52,4 +52,6 @@ class AiCommandController extends BaseController
52 $aiLog = new AiLog(); 52 $aiLog = new AiLog();
53 return $aiLog->add($param); 53 return $aiLog->add($param);
54 } 54 }
  55 +
  56 +
55 } 57 }
@@ -33,6 +33,7 @@ class RankDataLogic extends BaseLogic @@ -33,6 +33,7 @@ class RankDataLogic extends BaseLogic
33 33
34 //查数据 34 //查数据
35 $project = (new ProjectLogic())->getInfo($project_id); 35 $project = (new ProjectLogic())->getInfo($project_id);
  36 + $domain_info = (new DomainInfoLogic)->getDomainInfo($project_id);
36 $rank = RankData::where('project_id', $project_id)->first(); 37 $rank = RankData::where('project_id', $project_id)->first();
37 $rank_week = RankWeek::where('project_id', $project_id)->first(); 38 $rank_week = RankWeek::where('project_id', $project_id)->first();
38 $recomm_domain = RecommDomain::where('project_id', $project_id)->first(); 39 $recomm_domain = RecommDomain::where('project_id', $project_id)->first();
@@ -55,6 +56,8 @@ class RankDataLogic extends BaseLogic @@ -55,6 +56,8 @@ class RankDataLogic extends BaseLogic
55 $data['project'] = [ 56 $data['project'] = [
56 'company' => $project['company'], 57 'company' => $project['company'],
57 'domain' => $project['deploy_optimize']['domain'] ?? '', 58 'domain' => $project['deploy_optimize']['domain'] ?? '',
  59 + 'domain_info' => ($domain_info['domain_info']['creation_date'] ?? '') . ' - ' . ($domain_info['domain_info']['expiration_date'] ?? ''),
  60 + 'cert_info' => ($domain_info['ssl']['start_time'] ?? '') . ' - ' . ($domain_info['ssl']['end_time'] ?? ''),
58 'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0] ?? ''), 61 'plan' => str_replace('营销大师-', '全球搜-', $project['deploy_build']['plan'][0] ?? ''),
59 'keyword_num' => $project['deploy_build']['keyword_num'], 62 'keyword_num' => $project['deploy_build']['keyword_num'],
60 'compliance_day' => $rank['compliance_day'] ?? 0, 63 'compliance_day' => $rank['compliance_day'] ?? 0,