作者 赵彬吉

update

  1 +<?php
  2 +
  3 +namespace App\Console\Commands\Inquiry;
  4 +
  5 +use App\Models\Domain\DomainInfo;
  6 +use App\Models\Inquiry\ReInquiryCount;
  7 +use Illuminate\Console\Command;
  8 +
  9 +/**
  10 + * Class FBInquiryRemainDay
  11 + * @package App\Console\Commands\Inquiry
  12 + */
  13 +class FBInquiryRemainDay extends Command
  14 +{
  15 + /**
  16 + * The name and signature of the console command.
  17 + *
  18 + * @var string
  19 + */
  20 + protected $signature = 'fb_inquiry_remain_day';
  21 +
  22 + /**
  23 + * The console command description.
  24 + *
  25 + * @var string
  26 + */
  27 + protected $description = '执行询盘请求';
  28 +
  29 + /**
  30 + * Create a new command instance.
  31 + *
  32 + * @return void
  33 + */
  34 + public function __construct()
  35 + {
  36 + parent::__construct();
  37 + }
  38 +
  39 +
  40 +
  41 + public function handle()
  42 + {
  43 + $list = ReInquiryCount::all();
  44 + foreach ($list as $item){
  45 + $this->output('start:' . $item['id']);
  46 +
  47 + $item->tasks = $item->tasks; //调用访问器
  48 + $is_v6 = 0;
  49 + foreach ($item->tasks as $task){
  50 + if($task['is_v6']){
  51 + $is_v6 = 1;
  52 + }
  53 + }
  54 + if($is_v6){
  55 + $item['project_id'] = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
  56 + }else{
  57 + $item['project_id'] = 0;
  58 + }
  59 + //获取剩余天数
  60 + ReInquiryCount::getRemainingDays($item['domain'], $item['type'], $item['project_id']);
  61 + }
  62 +
  63 + }
  64 +
  65 + public function output($message)
  66 + {
  67 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  68 + }
  69 +}
@@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel @@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel
39 $schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1); 39 $schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1);
40 // 优化预设关键词 同步 20点会开始TDK生成 40 // 优化预设关键词 同步 20点会开始TDK生成
41 $schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1); 41 $schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1);
  42 + //FB询盘剩余时间
  43 + $schedule->command('fb_inquiry_remain_day')->dailyAt('02:00')->withoutOverlapping(1);
42 } 44 }
43 45
44 /** 46 /**