|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Inquiry;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Helper\Arr;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Inquiry\ReInquiryForm;
|
|
|
|
use App\Models\Inquiry\ReInquiryTask;
|
|
|
|
use App\Utils\HttpUtils;
|
|
|
|
use GuzzleHttp\Exception\GuzzleException;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class SyncInquiry
|
|
|
|
* @package App\Console\Commands\Inquiry
|
|
|
|
*/
|
|
|
|
class UpdateSiteVersion extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'update_site_version';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = '更新关联网站版本';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new command instance.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
while (true) {
|
|
|
|
$list = ReInquiryTask::select(['target', 'id'])->get();
|
|
|
|
foreach ($list as $item){
|
|
|
|
$this->output('sync task :' . $item['id']);
|
|
|
|
if(empty($item['target'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$update = false;
|
|
|
|
$target = $item['target'];
|
|
|
|
foreach ($target as &$site){
|
|
|
|
if(!$site['is_v6']){
|
|
|
|
$domain_info = DomainInfo::where('domain', $site['url'])->first();
|
|
|
|
if($domain_info){
|
|
|
|
$site['is_v6'] = "1";
|
|
|
|
$update = true;
|
|
|
|
|
|
|
|
echo date('Y-m-d H:i:s') . ' | ' . $site['url'] . ' 升级到V6' . PHP_EOL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($update){
|
|
|
|
$item->target = $target;
|
|
|
|
$item->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->output('sleep');
|
|
|
|
sleep(300);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function output($message)
|
|
|
|
{
|
|
|
|
echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|