作者 刘锟

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

@@ -167,7 +167,7 @@ class VideoTask extends Command @@ -167,7 +167,7 @@ class VideoTask extends Command
167 */ 167 */
168 public function getProjectKeyword($number) 168 public function getProjectKeyword($number)
169 { 169 {
170 - $keyword_arr_id = Keyword::where('video', null)->where('title', 'not like', '%-tag%')->whereNotNull('keyword_content')->pluck('id')->toArray(); 170 + $keyword_arr_id = Keyword::where('video', null)->where('route', 'not like', '%-tag%')->whereNotNull('keyword_content')->pluck('id')->toArray();
171 $keyword_id = array_rand($keyword_arr_id, $number); 171 $keyword_id = array_rand($keyword_arr_id, $number);
172 $keyword = Keyword::whereIn("id", $keyword_id)->get(); 172 $keyword = Keyword::whereIn("id", $keyword_id)->get();
173 return $keyword; 173 return $keyword;
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :UpdateRoute.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/20 15:07
  8 + */
  9 +
  10 +namespace App\Console\Commands\UpgradeKeyword;
  11 +
  12 +use App\Helper\Arr;
  13 +use App\Helper\Translate;
  14 +use App\Models\CustomModule\CustomModuleCategory;
  15 +use App\Models\CustomModule\CustomModuleContent;
  16 +use App\Models\Product\CategoryRelated;
  17 +use App\Models\Product\Keyword;
  18 +use App\Models\Product\Product;
  19 +use App\Models\Project\Project;
  20 +use App\Models\RouteMap\RouteMap;
  21 +use App\Models\Template\BTemplate;
  22 +use App\Services\ProjectServer;
  23 +use Illuminate\Console\Command;
  24 +use Illuminate\Support\Facades\DB;
  25 +
  26 +/**
  27 + * @remark :更新所有项目的路由
  28 + * @name :UpdateRoute
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2023/11/20 15:08
  32 + */
  33 +class UpdateKeyword extends Command
  34 +{
  35 + /**
  36 + * The name and signature of the console command.
  37 + *
  38 + * @var string
  39 + */
  40 + protected $signature = 'update_keyword_route';
  41 +
  42 + /**
  43 + * The console command description.
  44 + *
  45 + * @var string
  46 + */
  47 + protected $description = '升级项目-关键字路由与其他路由重复时,删除关键字';
  48 +
  49 + /**
  50 + * @remark :统一更新路由
  51 + * @name :handle
  52 + * @author :lyh
  53 + * @method :post
  54 + * @time :2023/11/20 15:13
  55 + */
  56 + public function handle(){
  57 + $projectModel = new Project();
  58 + $list = $projectModel->list(['is_upgrade'=>1,'delete_status'=>0]);
  59 +
  60 + foreach ($list as $v){
  61 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  62 + ProjectServer::useProject($v['id']);
  63 + $this->getRouteMap();
  64 + DB::disconnect('custom_mysql');
  65 + }
  66 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  67 + }
  68 +
  69 +
  70 + /**
  71 + * @remark :升级项目查看路由是否有重复路由
  72 + * @name :getRouteMap
  73 + * @author :lyh
  74 + * @method :post
  75 + * @time :2024/1/4 11:53
  76 + */
  77 + public function getRouteMap(){
  78 + $routeMapModel = new RouteMap();
  79 + $list = $routeMapModel->list(['source'=>'product_keyword']);
  80 + foreach ($list as $k => $v){
  81 + $routeInfo = $routeMapModel->read(['source'=>['!=','product_keyword'],'route'=>$v['route']]);
  82 + if($routeInfo !== false){
  83 + try {
  84 + $keywordModel = new Keyword();
  85 + $keywordModel->del(['id'=>$v['source_id']]);
  86 + $routeMapModel->del(['id'=>$v['id']]);
  87 + }catch (\Exception $e){
  88 + echo date('Y-m-d H:i:s') . '关键字id:'.$v['source_id'] . PHP_EOL;
  89 + }
  90 + }
  91 + }
  92 + return true;
  93 + }
  94 +}
@@ -174,9 +174,11 @@ class WebTraffic extends Command @@ -174,9 +174,11 @@ class WebTraffic extends Command
174 } 174 }
175 $need_project = []; 175 $need_project = [];
176 foreach ($project_list as $project) { 176 foreach ($project_list as $project) {
  177 + Log::channel('traffic')->info('开始引流 project_id:' . $project['project_id']);
177 //随机引流间隔 178 //随机引流间隔
178 $res_sjjg = $this->get_rand($this->sjjg); 179 $res_sjjg = $this->get_rand($this->sjjg);
179 if ($res_sjjg == 1) { 180 if ($res_sjjg == 1) {
  181 + Log::channel('traffic')->info('随机不引流 project_id:' . $project['project_id']);
180 continue; 182 continue;
181 } 183 }
182 184
@@ -224,6 +226,7 @@ class WebTraffic extends Command @@ -224,6 +226,7 @@ class WebTraffic extends Command
224 } 226 }
225 //不访问 227 //不访问
226 if($res == 1){ 228 if($res == 1){
  229 + Log::channel('traffic')->info('特殊日期随机不引流 project_id:' . $project['project_id']);
227 unset($need_project[$project_key]); 230 unset($need_project[$project_key]);
228 unset($ips[$project_key]); 231 unset($ips[$project_key]);
229 } 232 }
  1 +<?php
  2 +
  3 +namespace App\Console\Commands;
  4 +
  5 +use App\Helper\Arr;
  6 +use App\Models\Product\Category;
  7 +use App\Models\Product\Product;
  8 +use App\Models\Project\OnlineCheck;
  9 +use App\Models\Project\Project;
  10 +use App\Models\Template\BCustomTemplate;
  11 +use App\Models\WebSetting\WebLanguage;
  12 +use App\Services\ProjectServer;
  13 +use Carbon\Carbon;
  14 +use GuzzleHttp\Client;
  15 +use GuzzleHttp\Promise\Utils;
  16 +use Illuminate\Console\Command;
  17 +use Illuminate\Support\Facades\Cache;
  18 +use Illuminate\Support\Facades\DB;
  19 +use Illuminate\Support\Facades\Log;
  20 +use Illuminate\Support\Str;
  21 +
  22 +/**
  23 + * 网站特殊引流
  24 + * 需要单独加流量的
  25 + * Class Traffic
  26 + * @package App\Console\Commands
  27 + * @author zbj
  28 + * @date 2023/5/18
  29 + */
  30 +class WebTrafficSpecial extends Command
  31 +{
  32 + /**
  33 + * The name and signature of the console command.
  34 + *
  35 + * @var string
  36 + */
  37 + protected $signature = 'web_traffic_special';
  38 +
  39 + /**
  40 + * The console command description.
  41 + *
  42 + * @var string
  43 + */
  44 + protected $description = '网站引流';
  45 +
  46 + /**
  47 + * Create a new command instance.
  48 + *
  49 + * @return void
  50 + */
  51 + public function __construct()
  52 + {
  53 + parent::__construct();
  54 + }
  55 +
  56 +
  57 + /**
  58 + * 要增加引流的项目及腰增加的数量
  59 + * key 要引流的ID
  60 + * value 每天要增加的流量
  61 + * @var array
  62 + */
  63 + protected $projects = [
  64 + 509 => 30
  65 + ];
  66 +
  67 +
  68 +
  69 + /**
  70 + * google域名后缀
  71 + * @var string[]
  72 + */
  73 + protected $suffix = [
  74 + 'co.jp' => '日本',
  75 + 'com.tr' => '土耳其',
  76 + 'nl' => '荷兰',
  77 + 'ru' => '俄罗斯',
  78 + 'fr' => '法国',
  79 + 'co.kr' => '韩国',
  80 + 'fi' => '芬兰',
  81 + 'be' => '比利时',
  82 + 'lt' => '立陶宛',
  83 + 'es' => '西班牙',
  84 + 'it' => '意大利',
  85 + 'com.au' => '澳大利亚',
  86 + 'no' => '挪威',
  87 + 'al' => '阿尔巴尼亚',
  88 + 'pt' => '葡萄牙',
  89 + 'lv' => '拉脱维亚',
  90 + 'hu' => '匈牙利',
  91 + 'cz' => '捷克',
  92 + 'de' => '德国',
  93 + 'ca' => '加拿大',
  94 + 'co.in' => '印度',
  95 + 'co.uk' => '英国',
  96 + 'com.vn' => '越南',
  97 + 'com.br' => '巴西',
  98 + 'co.il' => '以色列',
  99 + 'pl' => '波兰',
  100 + 'com.eg' => '埃及',
  101 + 'co.th' => '泰国',
  102 + 'sk' => '斯洛伐克',
  103 + 'ro' => '罗马尼亚',
  104 + 'com.mx' => '墨西哥',
  105 + 'com.my' => '马来西亚',
  106 + 'com.pk' => '巴基斯坦',
  107 + 'co.nz' => '新西兰',
  108 + 'co.za' => '南非',
  109 + 'com.ar' => '阿根廷',
  110 + 'com.kw' => '科威特',
  111 + 'com.sg' => '新加坡',
  112 + 'com.co' => '哥伦比亚',
  113 + 'co.id' => '印度尼西亚',
  114 + 'gr' => '希腊',
  115 + 'bg' => '保加利亚',
  116 + 'mn' => '蒙古',
  117 + 'dk' => '丹麦',
  118 + 'com.sa' => '沙特阿拉伯',
  119 + 'com.pe' => '秘鲁',
  120 + 'com.ph' => '菲律宾',
  121 + 'com.ua' => '乌克兰',
  122 + 'ge' => '格鲁吉亚',
  123 + 'ae' => '阿拉伯联合酋长国',
  124 + 'tn' => '突尼斯',
  125 + ];
  126 +
  127 + /**
  128 + * 概率值
  129 + * @var int[]
  130 + */
  131 + protected $sjjg = [720, 280];//访问间隔占比 访问|不访问
  132 + //访问页面类型占比 产品详情页、单页|产品分类页
  133 + protected $ymzb = [
  134 + 'urls_cats' => 700,
  135 + 'urls_details' => 300
  136 + ];
  137 + protected $sdzb = [600, 200, 150, 50]; //访问页面深度占比 1页|2页|3-6页|7-11页
  138 + protected $yddzb = [1 => 700, 2 => 300]; //移动端占比 pc|mobile
  139 + //模拟访问来源占比 (美国)
  140 + protected $lyzb = [
  141 + 'https://www.google.com/' => 630,
  142 + 'http://www.google.com/' => 30,
  143 + 'http://www.bing.com/' => 20,
  144 + 'https://www.bing.com/' => 5,
  145 + 'https://www.youtube.com/' => 5,
  146 + 'https://search.yahoo.com/' => 5,
  147 + 'https://www.facebook.com/' => 5,
  148 + ];
  149 +
  150 + //俄语
  151 + protected $eylyzb = [
  152 + 'https://www.yandex.com/' => 630,
  153 + 'https://www.google.com/' => 30,
  154 + 'http://www.google.com/' => 30,
  155 + 'http://www.bing.com/' => 20,
  156 + 'https://www.bing.com/' => 5,
  157 + 'https://www.youtube.com/' => 5,
  158 + 'https://search.yahoo.com/' => 5,
  159 + 'https://www.facebook.com/' => 5,
  160 + ];
  161 +
  162 + protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀
  163 +
  164 + protected $pc_ua = [
  165 + 0 => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11',
  166 + 1 => 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',
  167 + 2 => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1'
  168 + ];
  169 +
  170 + protected $mobile_ua = [
  171 + 0 => 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko; googleweblight) Chrome/38.0.1025.166 Mobile Safari/535.19',
  172 + ];
  173 +
  174 + /**
  175 + * @return bool
  176 + */
  177 + public function handle()
  178 + {
  179 + try {
  180 + $this->sleep();
  181 +
  182 + $page = 1;
  183 + while (true){
  184 + $project_list = $this->getProjectList($page);
  185 + if(!$project_list){
  186 + break;
  187 + }
  188 + $need_project = [];
  189 + foreach ($project_list as $project) {
  190 + Log::channel('traffic')->info('开始特殊引流 project_id:' . $project['project_id']);
  191 + //随机引流间隔
  192 + $res_sjjg = $this->get_rand($this->sjjg);
  193 + if ($res_sjjg == 1) {
  194 + Log::channel('traffic')->info('随机不特殊引流 project_id:' . $project['project_id']);
  195 + continue;
  196 + }
  197 +
  198 + $project_urls = $this->getProductUrls($project['project_id']);
  199 + $project_urls['home'] = $project['domain'];
  200 + //随机访问页面
  201 + $project['visit_urls'] = $this->getVisitUrls($project_urls);
  202 + //随机客户端
  203 + $project['device_port'] = $this->get_rand($this->yddzb);
  204 + $project['user_agent'] = $project['device_port'] == 1 ? Arr::random($this->pc_ua) : Arr::random($this->mobile_ua);
  205 +
  206 + $need_project[] = $project;
  207 + }
  208 + //随机访问ip
  209 + $ips = $this->getIpAreas(count($need_project));
  210 +
  211 + //特殊日期 降访问率
  212 + foreach ($need_project as $project_key => $project){
  213 + $diff = $ips[$project_key]['diff'];
  214 + //当地时间
  215 + $w = date('w', strtotime($diff . 'hour'));
  216 + $date = date('m-d', strtotime($diff . 'hour'));
  217 + //元旦节和圣诞节按照周六的比例处理
  218 + if(in_array($date, ['01-01', '12-25'])){
  219 + $w = 6;
  220 + }
  221 + switch ($w){
  222 + case 0:
  223 + //周日降70-80%
  224 + $rate = rand(70, 80) * 10;
  225 + $res = $this->get_rand([1000-$rate, $rate]);
  226 + break;
  227 + case 5:
  228 + //周5降30-40%
  229 + $rate = rand(30, 40) * 10;
  230 + $res = $this->get_rand([1000-$rate, $rate]);
  231 + break;
  232 + case 6:
  233 + //周6降60-70%
  234 + $rate = rand(60, 70) * 10;
  235 + $res = $this->get_rand([1000-$rate, $rate]);
  236 + break;
  237 + default:
  238 + $res = 0;
  239 + }
  240 + //不访问
  241 + if($res == 1){
  242 + Log::channel('traffic')->info('特殊日期随机不特殊引流 project_id:' . $project['project_id']);
  243 + unset($need_project[$project_key]);
  244 + unset($ips[$project_key]);
  245 + }
  246 + }
  247 +
  248 + //最多10层深度
  249 + $client = new Client(['verify' => false]);
  250 + for ($j = 0; $j < 10; $j++) {
  251 + for ($j = 0; $j < 10; $j++) {
  252 + //并发请求
  253 + $promises = [];
  254 + foreach ($need_project as $project_key => $project) {
  255 + if (empty($project['visit_urls'][$j])) {
  256 + continue;
  257 + }
  258 +
  259 + $data = [
  260 + 'ip' => $ips[$project_key]['ip'],
  261 + 'url' => $project['visit_urls'][$j],
  262 + 'device_port' => $project['device_port'],
  263 + 'referrer_url' => $this->getReferer($ips[$project_key]['ip_area'], $project['lang']),
  264 + 'user_agent' => $project['user_agent'],
  265 + ];
  266 + Log::channel('traffic')->info('traffic_special project_id:' . $project['project_id'], $data);
  267 + $promises[] = $client->postAsync($project['domain'] . 'api/traffic_visit', ['form_params' => $data]);
  268 + }
  269 +
  270 + if($promises){
  271 + Utils::settle($promises)->wait();
  272 + //每个深度随机等待
  273 + sleep(rand(2, 10));
  274 + }
  275 + }
  276 + }
  277 +
  278 + $page++;
  279 + }
  280 + }catch (\Exception $e){
  281 + Log::channel('traffic')->error($e->getMessage());
  282 + }
  283 + }
  284 +
  285 + /**
  286 + * 不同项目 休眠
  287 + */
  288 + protected function sleep(){
  289 + sleep(rand(5,480));
  290 + }
  291 +
  292 + /**
  293 + * 非俄语站的引流的项目
  294 + */
  295 + protected function getProjectList($page){
  296 + $ru_lang_id = WebLanguage::getIdByLang('ru');
  297 +
  298 + //推广项目
  299 + $list = Project::with('domainInfo')
  300 + ->leftJoin('gl_project_deploy_optimize as pdo', 'pdo.project_id', '=', 'gl_project.id')
  301 + ->leftJoin('gl_project_online_check as poc', 'poc.project_id', '=', 'gl_project.id')
  302 + ->where('pdo.domain', '>', 0)
  303 + ->where('poc.qa_status', OnlineCheck::STATUS_ONLINE_TRUE)
  304 + ->whereIn('gl_project.type', [Project::TYPE_TWO, Project::TYPE_FOUR])
  305 + ->where('gl_project.is_upgrade', 0) //非升级项目
  306 + ->where('gl_project.main_lang_id', '<>', $ru_lang_id) //非俄语站
  307 + ->whereIn('gl_project.id', array_keys($this->projects))
  308 + ->select(['pdo.project_id','gl_project.main_lang_id','gl_project.id'])->forPage($page, 500)->get();
  309 + //其他地方在引流的域名
  310 +// $other = DB::connection('projects_mysql')->table('projects')->where('switch', 1)->pluck('domain')->toArray();
  311 + $other = [];
  312 + $data = [];
  313 + foreach ($list as $project) {
  314 +
  315 + //根据增加的次数 设置间隔
  316 + if(Cache::get('traffic_special_' . $project['project_id'])){
  317 + continue;
  318 + }else{
  319 + $ttl = 24 * 60 * 60 / $this->projects[$project['project_id']];
  320 + Cache::put('traffic_special_' . $project['project_id'], 1, $ttl);
  321 + }
  322 +
  323 + $lang = WebLanguage::getLangById($project['main_lang_id']??1)['short'];
  324 + if(empty($project->domainInfo['domain'])){
  325 + continue;
  326 + }
  327 + //其他地方在引流就不再引流了
  328 + if(in_array($project->domainInfo['domain'], $other)){
  329 + continue;
  330 + }
  331 + $data[] = [
  332 + 'project_id' => $project['project_id'],
  333 + 'domain' => 'https://' . $project->domainInfo['domain'] . '/',
  334 + 'lang' => $lang
  335 + ];
  336 + }
  337 + return $data;
  338 + }
  339 +
  340 + /**
  341 + * 获取产品分类、单页和详情链接
  342 + */
  343 + protected function getProductUrls($project_id){
  344 + ProjectServer::useProject($project_id);
  345 + //已发布产品分类页面
  346 + $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category')
  347 + ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)
  348 + ->whereNull('deleted_at')
  349 + ->pluck('route','id')->toArray();
  350 +
  351 + //已发布单页面
  352 + $data['urls_page'] = [];
  353 +// $data['urls_page'] = DB::connection('custom_mysql')->table('gl_web_custom_template')
  354 +// ->where('project_id', $project_id)->where('url', '<>', '404')->where('status', BCustomTemplate::STATUS_ACTIVE)->pluck('url', 'id')->toArray();
  355 +
  356 + //已发布产品详情页
  357 + $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
  358 + ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
  359 + ->whereNull('deleted_at')
  360 + ->pluck('route', 'id')->toArray();
  361 +
  362 + $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
  363 + if(empty($data['urls_cats'])){
  364 + $data['urls_cats'] = $data['urls_details'];
  365 + }
  366 + DB::disconnect('custom_mysql');
  367 + return $data;
  368 + }
  369 +
  370 + /**
  371 + * 获取地区IP
  372 + */
  373 + protected function getIpAreas($num)
  374 + {
  375 + //本地时间为7-23点的地区
  376 + $h = date('H');
  377 + $areas = [];
  378 + $list = DB::table('gl_area_timezone')->get();
  379 + $time_zones = [];
  380 + foreach ($list as $v) {
  381 + $v = (array)$v;
  382 + $country_hour = $h + $v['diff'];
  383 + if ($country_hour < 0) {
  384 + $country_hour = 24 + $country_hour;
  385 + }
  386 + if ($country_hour >= 7 && $country_hour < 23) {
  387 + $areas[] = $v['name'];
  388 + $time_zones[$v['name']] = $v['diff'];
  389 + }
  390 + }
  391 + //根据地区随机取该地区的IP
  392 + $data = DB::table('gl_xunpan_ipdata')->whereIn('ip_area', $areas)->inRandomOrder()->limit($num)->get();
  393 + $data = Arr::s2a(Arr::a2s($data));
  394 + foreach ($data as &$item){
  395 + $item['diff'] = $time_zones[$item['ip_area']];
  396 + }
  397 + return $data;
  398 + }
  399 +
  400 + /**
  401 + * 概率算法
  402 + */
  403 + protected function get_rand($proArr) {
  404 + $result = '';
  405 + $proSum = array_sum($proArr);
  406 + foreach ($proArr as $key => $proCur) {
  407 + $randNum = mt_rand(1, $proSum);
  408 + if ($randNum <= $proCur) {
  409 + $result = $key;
  410 + break;
  411 + } else {
  412 + $proSum -= $proCur;
  413 + }
  414 + }
  415 + unset ($proArr);
  416 + return $result;
  417 + }
  418 +
  419 + /**
  420 + * 根据随机访问深度 随机获取访问页面
  421 + */
  422 + protected function getVisitUrls($project_urls){
  423 + //没有分类页 就只访问首页
  424 + if(!$project_urls['urls_cats']){
  425 + $url[] = $project_urls['home'];
  426 + return $url;
  427 + }
  428 + //随机访问深度
  429 + $res_sdzb = $this->get_rand($this->sdzb);
  430 + //随机访问页面类型
  431 + $res_ymzb = $this->get_rand($this->ymzb);
  432 +
  433 + $all_url = array_merge($project_urls['urls_cats'],$project_urls['urls_details']);
  434 + if(!$all_url){
  435 + $url[] = $project_urls['home'];
  436 + return $url;
  437 + }
  438 +
  439 + $url = [];
  440 + if($res_sdzb == 0){//深度一页
  441 + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb]) : '';
  442 + }elseif($res_sdzb == 1){//深度两页
  443 + $url[] = $project_urls['home'];
  444 + $url[] = $project_urls[$res_ymzb] ? Arr::random($project_urls[$res_ymzb]) : '';
  445 + }elseif($res_sdzb == 2){//深度3-6页
  446 + $yms = rand(2,5); //随机页面数
  447 + $url = Arr::random($all_url, $yms);
  448 + $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去
  449 + }elseif($res_sdzb == 3){//深度7-11页
  450 + $yms = rand(6,10); //随机页面数
  451 + $url = Arr::random($all_url, $yms);
  452 + $url = Arr::prepend($url, $project_urls['home']);//首页加到最前面去
  453 + }
  454 + foreach ($url as &$v){
  455 + if(!Str::contains($v, $project_urls['home'])){
  456 + if (FALSE === strpos($v, '.htm')) {
  457 + $v .= '/';
  458 + }
  459 + $v = $project_urls['home'] . $v;
  460 + }
  461 + }
  462 + return array_unique(array_filter($url));
  463 + }
  464 +
  465 + /**
  466 + * 获取访问来路
  467 + */
  468 + protected function getReferer($ip_area, $lang){
  469 +
  470 + if($lang == 'ru'){
  471 + return $this->get_rand($this->eylyzb);
  472 + }
  473 +
  474 + if($ip_area == '美国'){
  475 + $referer = $this->get_rand($this->lyzb);
  476 + }else{
  477 + $referer = 'https://www.google.com/';
  478 +
  479 + $suffix = array_search($ip_area, $this->suffix);
  480 + if($suffix){
  481 + $res_qtzb = $this->get_rand($this->otherzb);
  482 + if($res_qtzb == 1){
  483 + $referer = 'https://www.google.'.$suffix.'/';
  484 + }
  485 + }
  486 + }
  487 + return $referer;
  488 + }
  489 +}
@@ -20,13 +20,15 @@ class Kernel extends ConsoleKernel @@ -20,13 +20,15 @@ class Kernel extends ConsoleKernel
20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
21 $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 21 $schedule->command('rank_data')->dailyAt('07:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
22 $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次 22 $schedule->command('rank_data_speed')->dailyAt('01:10')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
23 - $schedule->command('rank_data_external_links')->dailyAt('01:20')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
24 - $schedule->command('rank_data_indexed_pages')->dailyAt('01:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次  
25 - $schedule->command('rank_data_recomm_domain')->dailyAt('01:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次  
26 - $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 23 + $schedule->command('rank_data_external_links')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
  24 + $schedule->command('rank_data_external_links')->dailyAt('18:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
  25 + $schedule->command('rank_data_indexed_pages')->dailyAt('07:30')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
  26 + $schedule->command('rank_data_recomm_domain')->dailyAt('07:40')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
  27 + $schedule->command('rank_data_week')->dailyAt('08:30')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 28 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
28 // $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次 29 // $schedule->command('count')->dailyAt('00:30')->withoutOverlapping(1); //每天凌晨1点执行一次
29 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 30 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
  31 + $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
30 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 32 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
31 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次 33 $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
32 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次 34 $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
@@ -4,6 +4,8 @@ namespace App\Http\Controllers\Api; @@ -4,6 +4,8 @@ namespace App\Http\Controllers\Api;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Exceptions\InquiryFilterException; 6 use App\Exceptions\InquiryFilterException;
  7 +use App\Models\Domain\DomainInfo;
  8 +use App\Models\Project\Project;
7 use App\Models\SyncSubmitTask\SyncSubmitTask; 9 use App\Models\SyncSubmitTask\SyncSubmitTask;
8 use App\Models\Visit\Visit; 10 use App\Models\Visit\Visit;
9 use App\Services\CosService; 11 use App\Services\CosService;
@@ -57,7 +59,7 @@ class InquiryController extends BaseController @@ -57,7 +59,7 @@ class InquiryController extends BaseController
57 } 59 }
58 60
59 /** 61 /**
60 - * @remark :修改 62 + * @remark :修改路由状态
61 * @name :editInquiryStatus 63 * @name :editInquiryStatus
62 * @author :lyh 64 * @author :lyh
63 * @method :post 65 * @method :post
@@ -65,15 +67,19 @@ class InquiryController extends BaseController @@ -65,15 +67,19 @@ class InquiryController extends BaseController
65 */ 67 */
66 public function editInquiryStatus(){ 68 public function editInquiryStatus(){
67 $this->request->validate([ 69 $this->request->validate([
68 - 'project_id'=>'required', 70 + 'domain'=>'required',
69 'ip'=>'required', 71 'ip'=>'required',
70 'updated_date'=>'required', 72 'updated_date'=>'required',
71 ],[ 73 ],[
72 - 'project_id.required' => 'project_id不能为空', 74 + 'domain.required' => 'domain不能为空',
73 'ip.required' => 'ip不能为空', 75 'ip.required' => 'ip不能为空',
74 'updated_date.required' => '日期不能为空', 76 'updated_date.required' => '日期不能为空',
75 ]); 77 ]);
76 - ProjectServer::useProject($this->param['project_id']); 78 + $project = Project::getProjectByDomain($this->param['domain']);
  79 + if(!$project){
  80 + $this->response('域名不存在',Code::SYSTEM_ERROR);
  81 + }
  82 + ProjectServer::useProject($project->id);
77 $customerVisitModel = new Visit(); 83 $customerVisitModel = new Visit();
78 $info = $customerVisitModel->read([ 84 $info = $customerVisitModel->read([
79 'ip'=>$this->param['ip'], 85 'ip'=>$this->param['ip'],
@@ -152,6 +152,8 @@ class CategoryLogic extends BaseLogic @@ -152,6 +152,8 @@ class CategoryLogic extends BaseLogic
152 $this->param['describe_image'][$k] = $v; 152 $this->param['describe_image'][$k] = $v;
153 } 153 }
154 $this->param['describe_image'] = json_encode($this->param['describe_image']); 154 $this->param['describe_image'] = json_encode($this->param['describe_image']);
  155 + }else{
  156 + $this->param['describe_image'] = json_encode([]);
155 } 157 }
156 return $this->success($param); 158 return $this->success($param);
157 } 159 }
@@ -522,7 +522,7 @@ class RankDataLogic extends BaseLogic @@ -522,7 +522,7 @@ class RankDataLogic extends BaseLogic
522 522
523 $model = ExternalLinksModel::where('project_id', $project_id)->first(); 523 $model = ExternalLinksModel::where('project_id', $project_id)->first();
524 if ($model && $model->updated_date >= getThisWeekStarDate() && !$force) { 524 if ($model && $model->updated_date >= getThisWeekStarDate() && !$force) {
525 - continue; 525 + //continue;
526 } 526 }
527 if (!$model) { 527 if (!$model) {
528 $model = new ExternalLinksModel(); 528 $model = new ExternalLinksModel();
@@ -48,8 +48,8 @@ class QueryListener @@ -48,8 +48,8 @@ class QueryListener
48 $log = $log.' [ RunTime:'.$event->time.'ms ] '; 48 $log = $log.' [ RunTime:'.$event->time.'ms ] ';
49 Log::debug($log); 49 Log::debug($log);
50 } 50 }
51 - //监听9644这个api_no是TM咋个被改的  
52 - if (in_array(9644, $event->bindings) && Str::contains($event->sql, 'update') && Str::contains($event->sql, '`api_no` =')) { 51 + //监听api_no是TM咋个被改的
  52 + if (Str::contains($event->sql, 'update') && Str::contains($event->sql, '`api_no` =')) {
53 //记录debug 根据这个溯源 53 //记录debug 根据这个溯源
54 $trace = debug_backtrace(); 54 $trace = debug_backtrace();
55 $traces = []; 55 $traces = [];