58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\PropertyWebCheckDns;
|
|
|
|
use App\Core\Service\PropertyWebService;
|
|
use App\Exceptions\ApiErrorException;
|
|
use Illuminate\Console\Command;
|
|
use Exception;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
class PropertyWebCheckDns extends Command
|
|
{
|
|
|
|
protected $signature = 'cron:property-web-check-dns'; // read table name column, update table key column
|
|
|
|
protected $description = '';
|
|
private $propertyWebService;
|
|
|
|
public function __construct(
|
|
PropertyWebService $propertyWebService
|
|
)
|
|
{
|
|
|
|
$this->propertyWebService = $propertyWebService;
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
|
|
|
|
try {
|
|
|
|
$this->info(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' Check DNS Status start');
|
|
$process = $this->propertyWebService->checkDnsStatus();
|
|
if($process['status'] != 'success'){
|
|
throw new Exception($process['message']) ;
|
|
|
|
}
|
|
$this->info(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' Check DNS Status finished');
|
|
|
|
} catch (Exception $e) {
|
|
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
|
|
Log::error($message);
|
|
$this->error(date('Y-m-d H:i:s') . ' : ' . date('Y-m-d') . ' ERROR: ' . $message);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|