作者 赵彬吉

update

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Console\Commands\WebTraffic; 3 namespace App\Console\Commands\WebTraffic;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Models\Ai\AiBlog;
6 use App\Models\Product\Category; 7 use App\Models\Product\Category;
7 use App\Models\Product\Product; 8 use App\Models\Product\Product;
8 use App\Models\Project\OnlineCheck; 9 use App\Models\Project\OnlineCheck;
@@ -361,8 +362,19 @@ class WebTraffic extends Command @@ -361,8 +362,19 @@ class WebTraffic extends Command
361 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 362 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
362 ->where('project_id', $project_id)->where('status', Product::STATUS_ON) 363 ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
363 ->whereNull('deleted_at') 364 ->whereNull('deleted_at')
  365 + ->inRandomOrder()
  366 + ->limit(100)
364 ->pluck('route', 'id')->toArray(); 367 ->pluck('route', 'id')->toArray();
365 368
  369 + //已发布AI博客
  370 + $ai_blog_urls = DB::connection('custom_mysql')->table('gl_ai_blog')
  371 + ->where('project_id', $project_id)->where('status', AiBlog::STATUS_FINISH)
  372 + ->inRandomOrder()
  373 + ->limit(20)
  374 + ->pluck('route', 'id')->toArray();
  375 +
  376 + $data['urls_details'] = array_merge($data['urls_details'], $ai_blog_urls);
  377 +
366 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 378 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
367 if(empty($data['urls_cats'])){ 379 if(empty($data['urls_cats'])){
368 $data['urls_cats'] = $data['urls_details']; 380 $data['urls_cats'] = $data['urls_details'];
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Console\Commands\WebTraffic; 3 namespace App\Console\Commands\WebTraffic;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Models\Ai\AiBlog;
6 use App\Models\HomeCount\Count; 7 use App\Models\HomeCount\Count;
7 use App\Models\Product\Category; 8 use App\Models\Product\Category;
8 use App\Models\Product\Product; 9 use App\Models\Product\Product;
@@ -320,6 +321,7 @@ class WebTrafficFix extends Command @@ -320,6 +321,7 @@ class WebTrafficFix extends Command
320 * 获取产品分类、单页和详情链接 321 * 获取产品分类、单页和详情链接
321 */ 322 */
322 protected function getProductUrls($project_id){ 323 protected function getProductUrls($project_id){
  324 + ProjectServer::useProject($project_id);
323 //已发布产品分类页面 325 //已发布产品分类页面
324 $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category') 326 $data['urls_cats'] = DB::connection('custom_mysql')->table('gl_product_category')
325 ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE) 327 ->where('project_id', $project_id)->where('status', Category::STATUS_ACTIVE)
@@ -335,8 +337,19 @@ class WebTrafficFix extends Command @@ -335,8 +337,19 @@ class WebTrafficFix extends Command
335 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 337 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
336 ->where('project_id', $project_id)->where('status', Product::STATUS_ON) 338 ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
337 ->whereNull('deleted_at') 339 ->whereNull('deleted_at')
  340 + ->inRandomOrder()
  341 + ->limit(100)
338 ->pluck('route', 'id')->toArray(); 342 ->pluck('route', 'id')->toArray();
339 343
  344 + //已发布AI博客
  345 + $ai_blog_urls = DB::connection('custom_mysql')->table('gl_ai_blog')
  346 + ->where('project_id', $project_id)->where('status', AiBlog::STATUS_FINISH)
  347 + ->inRandomOrder()
  348 + ->limit(20)
  349 + ->pluck('route', 'id')->toArray();
  350 +
  351 + $data['urls_details'] = array_merge($data['urls_details'], $ai_blog_urls);
  352 +
340 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 353 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
341 if(empty($data['urls_cats'])){ 354 if(empty($data['urls_cats'])){
342 $data['urls_cats'] = $data['urls_details']; 355 $data['urls_cats'] = $data['urls_details'];
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Console\Commands\WebTraffic; 3 namespace App\Console\Commands\WebTraffic;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Models\Ai\AiBlog;
6 use App\Models\Product\Category; 7 use App\Models\Product\Category;
7 use App\Models\Product\Product; 8 use App\Models\Product\Product;
8 use App\Models\Project\OnlineCheck; 9 use App\Models\Project\OnlineCheck;
@@ -391,8 +392,19 @@ class WebTrafficRussia extends Command @@ -391,8 +392,19 @@ class WebTrafficRussia extends Command
391 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 392 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
392 ->where('project_id', $project_id)->where('status', Product::STATUS_ON) 393 ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
393 ->whereNull('deleted_at') 394 ->whereNull('deleted_at')
  395 + ->inRandomOrder()
  396 + ->limit(100)
394 ->pluck('route', 'id')->toArray(); 397 ->pluck('route', 'id')->toArray();
395 398
  399 + //已发布AI博客
  400 + $ai_blog_urls = DB::connection('custom_mysql')->table('gl_ai_blog')
  401 + ->where('project_id', $project_id)->where('status', AiBlog::STATUS_FINISH)
  402 + ->inRandomOrder()
  403 + ->limit(20)
  404 + ->pluck('route', 'id')->toArray();
  405 +
  406 + $data['urls_details'] = array_merge($data['urls_details'], $ai_blog_urls);
  407 +
396 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 408 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
397 if(empty($data['urls_cats'])){ 409 if(empty($data['urls_cats'])){
398 $data['urls_cats'] = $data['urls_details']; 410 $data['urls_cats'] = $data['urls_details'];
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Console\Commands\WebTraffic; 3 namespace App\Console\Commands\WebTraffic;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Models\Ai\AiBlog;
6 use App\Models\Product\Category; 7 use App\Models\Product\Category;
7 use App\Models\Product\Product; 8 use App\Models\Product\Product;
8 use App\Models\Project\OnlineCheck; 9 use App\Models\Project\OnlineCheck;
@@ -382,8 +383,19 @@ class WebTrafficRussiaSpecial extends Command @@ -382,8 +383,19 @@ class WebTrafficRussiaSpecial extends Command
382 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 383 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
383 ->where('project_id', $project_id)->where('status', Product::STATUS_ON) 384 ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
384 ->whereNull('deleted_at') 385 ->whereNull('deleted_at')
  386 + ->inRandomOrder()
  387 + ->limit(100)
385 ->pluck('route', 'id')->toArray(); 388 ->pluck('route', 'id')->toArray();
386 389
  390 + //已发布AI博客
  391 + $ai_blog_urls = DB::connection('custom_mysql')->table('gl_ai_blog')
  392 + ->where('project_id', $project_id)->where('status', AiBlog::STATUS_FINISH)
  393 + ->inRandomOrder()
  394 + ->limit(20)
  395 + ->pluck('route', 'id')->toArray();
  396 +
  397 + $data['urls_details'] = array_merge($data['urls_details'], $ai_blog_urls);
  398 +
387 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 399 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
388 if(empty($data['urls_cats'])){ 400 if(empty($data['urls_cats'])){
389 $data['urls_cats'] = $data['urls_details']; 401 $data['urls_cats'] = $data['urls_details'];
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Console\Commands\WebTraffic; 3 namespace App\Console\Commands\WebTraffic;
4 4
5 use App\Helper\Arr; 5 use App\Helper\Arr;
  6 +use App\Models\Ai\AiBlog;
6 use App\Models\Product\Category; 7 use App\Models\Product\Category;
7 use App\Models\Product\Product; 8 use App\Models\Product\Product;
8 use App\Models\Project\OnlineCheck; 9 use App\Models\Project\OnlineCheck;
@@ -348,8 +349,19 @@ class WebTrafficSpecial extends Command @@ -348,8 +349,19 @@ class WebTrafficSpecial extends Command
348 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product') 349 $data['urls_details'] = DB::connection('custom_mysql')->table('gl_product')
349 ->where('project_id', $project_id)->where('status', Product::STATUS_ON) 350 ->where('project_id', $project_id)->where('status', Product::STATUS_ON)
350 ->whereNull('deleted_at') 351 ->whereNull('deleted_at')
  352 + ->inRandomOrder()
  353 + ->limit(100)
351 ->pluck('route', 'id')->toArray(); 354 ->pluck('route', 'id')->toArray();
352 355
  356 + //已发布AI博客
  357 + $ai_blog_urls = DB::connection('custom_mysql')->table('gl_ai_blog')
  358 + ->where('project_id', $project_id)->where('status', AiBlog::STATUS_FINISH)
  359 + ->inRandomOrder()
  360 + ->limit(20)
  361 + ->pluck('route', 'id')->toArray();
  362 +
  363 + $data['urls_details'] = array_merge($data['urls_details'], $ai_blog_urls);
  364 +
353 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']); 365 $data['urls_cats'] = array_merge($data['urls_cats'], $data['urls_page']);
354 if(empty($data['urls_cats'])){ 366 if(empty($data['urls_cats'])){
355 $data['urls_cats'] = $data['urls_details']; 367 $data['urls_cats'] = $data['urls_details'];