scheduled jobs

This commit is contained in:
2018-11-23 01:23:50 -06:00
parent b6c93c81e0
commit 05b8e67648
8 changed files with 101 additions and 9 deletions
+18 -1
View File
@@ -4,14 +4,19 @@ namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use App\Models\AllianceCorp;
use App\Models\ScheduleJob;
use Carbon\Carbon;
use Seat\Eseye\Cache\NullCache;
use Seat\Eseye\Configuration;
use Seat\Eseye\Containers\EsiAuthentication;
use Seat\Eseye\Eseye;
class getCorps extends Command
class GetCorps extends Command
{
/**
* The name and signature of the console command.
@@ -44,6 +49,13 @@ class getCorps extends Command
*/
public function handle()
{
//Add an entry into the jobs table
$job = new ScheduleJob;
$time = Carbon::now();
$job->job_name = 'GetCorps';
$job->job_state = 'Starting';
$job->system_time = $time;
$job->save();
//Set the parameters for ESI
$configuration = Configuration::getInstance();
$configuration->logfile_location = 'var/www/w4rpservices/storage/logs/eseye';
@@ -72,5 +84,10 @@ class getCorps extends Command
$entry->name = $corpInfo->name;
$entry->save();
}
//If the job is finished we need to mark it in the table
DB::table('schedule_jobs')->where('system_time', $time)->update([
'job_state' => 'Finished',
]);
}
}