作者 赵彬吉

bmseo rankdata

@@ -33,6 +33,7 @@ use Illuminate\Database\Eloquent\Model; @@ -33,6 +33,7 @@ use Illuminate\Database\Eloquent\Model;
33 use Illuminate\Support\Collection; 33 use Illuminate\Support\Collection;
34 use Illuminate\Support\Facades\Cache; 34 use Illuminate\Support\Facades\Cache;
35 use Illuminate\Support\Facades\Log; 35 use Illuminate\Support\Facades\Log;
  36 +use Illuminate\Support\Str;
36 37
37 class RankDataLogic extends BaseLogic 38 class RankDataLogic extends BaseLogic
38 { 39 {
@@ -194,6 +195,11 @@ class RankDataLogic extends BaseLogic @@ -194,6 +195,11 @@ class RankDataLogic extends BaseLogic
194 $data['current_api_no'] = $api_no; 195 $data['current_api_no'] = $api_no;
195 $data['current_api_source'] = $api_no == 10690 ? 'Yandex' : 'Google'; 196 $data['current_api_source'] = $api_no == 10690 ? 'Yandex' : 'Google';
196 } 197 }
  198 + $data['api_no'] = $api_no;
  199 + $bmseo_id = RankDataBmseo::where('project_id', $project_id)->value('id');
  200 + if($bmseo_id){
  201 + $data['bmseo_api_no'] = $bmseo_id . '_bmseo';
  202 + }
197 203
198 return $data; 204 return $data;
199 } 205 }
@@ -227,7 +233,12 @@ class RankDataLogic extends BaseLogic @@ -227,7 +233,12 @@ class RankDataLogic extends BaseLogic
227 $ai_projects = $this->getAiProjects()['data'] ?? []; 233 $ai_projects = $this->getAiProjects()['data'] ?? [];
228 $flg_ai = $this->getAiFlag($ai_projects, $domain); 234 $flg_ai = $this->getAiFlag($ai_projects, $domain);
229 $ai_domain = str_replace('www.', '', $this->getAiProjects($domain)['domain'] ?? ''); 235 $ai_domain = str_replace('www.', '', $this->getAiProjects($domain)['domain'] ?? '');
230 - $list = RankData::where('project_id', $project_id)->where('api_no', $api_no)->where('lang', $lang)->value('data') ?: []; 236 + if (Str::endsWith($api_no, '_bmseo')) {
  237 + $list = RankDataBmseo::where('project_id', $project_id)->where('api_no', $api_no)->where('lang', $lang)->value('data') ?: [];
  238 + } else {
  239 + $list = RankData::where('project_id', $project_id)->where('api_no', $api_no)->where('lang', $lang)->value('data') ?: [];
  240 + }
  241 +
231 $list30 = []; //排名前三十的 242 $list30 = []; //排名前三十的
232 $list30_0 = []; //排名前三十且近三天没有排名的 243 $list30_0 = []; //排名前三十且近三天没有排名的
233 $list100 = []; //排名前100的 244 $list100 = []; //排名前100的