作者 赵彬吉

update

<?php
namespace App\Console\Commands\Inquiry;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\ReInquiryCount;
use Illuminate\Console\Command;
/**
* Class FBInquiryRemainDay
* @package App\Console\Commands\Inquiry
*/
class FBInquiryRemainDay extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'fb_inquiry_remain_day';
/**
* The console command description.
*
* @var string
*/
protected $description = '执行询盘请求';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
public function handle()
{
$list = ReInquiryCount::all();
foreach ($list as $item){
$this->output('start:' . $item['id']);
$item->tasks = $item->tasks; //调用访问器
$is_v6 = 0;
foreach ($item->tasks as $task){
if($task['is_v6']){
$is_v6 = 1;
}
}
if($is_v6){
$item['project_id'] = DomainInfo::where('domain', $item['domain'])->value('project_id') ?: 0;
}else{
$item['project_id'] = 0;
}
//获取剩余天数
ReInquiryCount::getRemainingDays($item['domain'], $item['type'], $item['project_id']);
}
}
public function output($message)
{
echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
}
}
... ...
... ... @@ -39,6 +39,8 @@ class Kernel extends ConsoleKernel
$schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1);
// 优化预设关键词 同步 20点会开始TDK生成
$schedule->command('optimize_set_keyword_sync')->dailyAt('20:00')->withoutOverlapping(1);
//FB询盘剩余时间
$schedule->command('fb_inquiry_remain_day')->dailyAt('02:00')->withoutOverlapping(1);
}
/**
... ...