added fleet activity model

created new commands helper class to help with certain task across all scheduled task
updated the task to use the new class
partially updated fleet controller
This commit is contained in:
2018-12-03 13:00:58 -06:00
parent ae8f29c7ef
commit 8bbd83da90
10 changed files with 208 additions and 60 deletions
+7 -11
View File
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Carbon\Carbon;
use Commands\Library\CommandHelper;
use App\Library\MoonCalc;
@@ -41,20 +42,15 @@ class UpdateMoonPricing extends Command
*/
public function handle()
{
//Set the time the job has started
$job = new ScheduleJob;
$time = Carbon::now();
$job->job_name = 'CorpJournal';
$job->job_state = 'Starting';
$job->system_time = $time;
$job->save();
//Create the command helper container
$task = new CommandHelper('CorpJournal');
//Add the entry into the jobs table saying the job is starting
$task->SetStartStatus();
$moonCalc = new MoonCalc();
$moonCalc->FetchNewPrices();
//Set the state of the job as finished
DB::table('schedule_jobs')->where('system_time', $time)->update([
'job_state' => 'Finished',
]);
//Mark the job as finished
$task->SetStopStatus();
}
}