|
...
|
...
|
@@ -8,6 +8,7 @@ use App\Models\Product\Product; |
|
|
|
use App\Models\Project\OnlineCheck;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
|
|
use App\Models\WebSetting\WebLanguage;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use GuzzleHttp\Client;
|
|
...
|
...
|
@@ -130,6 +131,19 @@ class WebTraffic extends Command |
|
|
|
'https://search.yahoo.com/' => 5,
|
|
|
|
'https://www.facebook.com/' => 5,
|
|
|
|
];
|
|
|
|
|
|
|
|
//俄语
|
|
|
|
protected $eylyzb = [
|
|
|
|
'https://www.yandex.com/' => 630,
|
|
|
|
'https://www.google.com/' => 30,
|
|
|
|
'http://www.google.com/' => 30,
|
|
|
|
'http://www.bing.com/' => 20,
|
|
|
|
'https://www.bing.com/' => 5,
|
|
|
|
'https://www.youtube.com/' => 5,
|
|
|
|
'https://search.yahoo.com/' => 5,
|
|
|
|
'https://www.facebook.com/' => 5,
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀
|
|
|
|
|
|
|
|
protected $pc_ua = [
|
|
...
|
...
|
@@ -230,7 +244,7 @@ class WebTraffic extends Command |
|
|
|
'ip' => $ips[$project_key]['ip'],
|
|
|
|
'url' => $project['visit_urls'][$j],
|
|
|
|
'device_port' => $project['device_port'],
|
|
|
|
'referrer_url' => $this->getReferer($ips[$project_key]['ip_area']),
|
|
|
|
'referrer_url' => $this->getReferer($ips[$project_key]['ip_area'], $project['lang']),
|
|
|
|
'user_agent' => $project['user_agent'],
|
|
|
|
];
|
|
|
|
Log::channel('traffic')->info('traffic project_id:' . $project['project_id'], $data);
|
|
...
|
...
|
@@ -293,12 +307,15 @@ class WebTraffic extends Command |
|
|
|
$startTime = Carbon::now()->addMonths(-9)->startOfDay()->toDateTimeString();
|
|
|
|
$query->where('pdo.start_date', '<', $startTime);
|
|
|
|
}
|
|
|
|
})->select('pdo.project_id')->forPage($page, 500)->get();
|
|
|
|
})->select(['pdo.project_id','gl_project.main_lang_id'])->forPage($page, 500)->get();
|
|
|
|
//其他地方在引流的域名
|
|
|
|
$other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
|
|
|
|
|
|
|
|
$data = [];
|
|
|
|
foreach ($list as $project) {
|
|
|
|
$lang = WebLanguage::getLangById($this->project['main_lang_id']??1)['short'];
|
|
|
|
if(empty($project->domainInfo['domain'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//其他地方在引流就不再引流了
|
|
|
|
if(in_array($project->domainInfo['domain'], $other)){
|
|
|
|
continue;
|
|
...
|
...
|
@@ -306,9 +323,9 @@ class WebTraffic extends Command |
|
|
|
$data[] = [
|
|
|
|
'project_id' => $project['project_id'],
|
|
|
|
'domain' => 'https://' . $project->domainInfo['domain'] . '/',
|
|
|
|
'lang' => $lang
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -440,7 +457,12 @@ class WebTraffic extends Command |
|
|
|
/**
|
|
|
|
* 获取访问来路
|
|
|
|
*/
|
|
|
|
protected function getReferer($ip_area){
|
|
|
|
protected function getReferer($ip_area, $lang){
|
|
|
|
|
|
|
|
if($lang == 'ru'){
|
|
|
|
return $this->get_rand($this->eylyzb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if($ip_area == '美国'){
|
|
|
|
$referer = $this->get_rand($this->lyzb);
|
|
|
|
}else{
|
...
|
...
|
|