FBInquiryRemainDay.php 1.5 KB
<?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;
    }
}