scheduled jobs
This commit is contained in:
@@ -12,6 +12,9 @@ use App\Library\Esi;
|
||||
use App\Models\EsiScope;
|
||||
use App\Models\EsiToken;
|
||||
use App\Models\Structure;
|
||||
use App\Models\ScheduleJob;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class CorpJournal extends Command
|
||||
{
|
||||
@@ -46,6 +49,13 @@ class CorpJournal extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Add an entry into the jobs table
|
||||
$job = new ScheduleJob;
|
||||
$time = Carbon::now();
|
||||
$job->name = 'CorpJournal';
|
||||
$job->state = 'Starting';
|
||||
$job->system_time = $time;
|
||||
$job->save();
|
||||
//Setup the Finances Container
|
||||
$finance = new Finances();
|
||||
//Get the corps with structures logged in the database
|
||||
@@ -56,6 +66,10 @@ class CorpJournal extends Command
|
||||
$this->GetJournal($structure->character_id);
|
||||
}
|
||||
|
||||
//Mark the job as finished
|
||||
DB::table('schedule_jobs')->where('system_time', $time)->update([
|
||||
'job_state' => 'Finished',
|
||||
]);
|
||||
}
|
||||
|
||||
private function GetJournal($charId) {
|
||||
|
||||
@@ -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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,7 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command(CorpJournal::class)->everyFifteenMinutes();
|
||||
// $schedule->command(getCorps)->daily();
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
//$schedule->command(GetCorps::class)->daily();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user