schedule testing
This commit is contained in:
@@ -58,12 +58,22 @@ class CorpJournal extends Command
|
||||
$job->save();
|
||||
//Setup the Finances Container
|
||||
$finance = new Finances();
|
||||
//Setup an array to store corporations which have been logged so we don't keep calling the same ones. We need
|
||||
//this step in order to save time during the cronjob.
|
||||
$finishedCorps = array();
|
||||
//Get the corps with structures logged in the database
|
||||
$structures = DB::table('CorpStructures')->get();
|
||||
//For each structure get the corp journals from the corporation owning the structure
|
||||
//After getting the corp journal for the corporation, let's not do the corporation again
|
||||
foreach($structures as $structure) {
|
||||
$this->line('Getting corp journal');
|
||||
foreach($finishedCorps as $finished) {
|
||||
if($finished == $structure->corporation_id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//$this->line('Getting corp journal');
|
||||
$this->GetJournal($structure->character_id);
|
||||
$finishedCorps[sizeof($finishedCorps)] = $structure->corporation_id;
|
||||
}
|
||||
|
||||
//Mark the job as finished
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use DB;
|
||||
use Carbon\Carbon;
|
||||
|
||||
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;
|
||||
@@ -23,7 +21,7 @@ class GetCorps extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'services:getCorps';
|
||||
protected $signature = 'services:getcorps';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
||||
@@ -3,8 +3,17 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
use DB;
|
||||
|
||||
use App\Library\Finances;
|
||||
use App\Library\Esi;
|
||||
use App\Library\Mail;
|
||||
use App\Models\ScheduleJob;
|
||||
|
||||
use Seat\Eseye\Cache\NullCache;
|
||||
use Seat\Eseye\Configuration;
|
||||
use Seat\Eseye\Containers\EsiAuthentication;
|
||||
use Seat\Eseye\Eseye;
|
||||
|
||||
class sendMail extends Command
|
||||
{
|
||||
@@ -42,6 +51,19 @@ class sendMail extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
//Add an entry into the jobs table
|
||||
$job = new ScheduleJob;
|
||||
$time = Carbon::now();
|
||||
$job->job_name = 'SendMail';
|
||||
$job->job_state = 'Starting';
|
||||
$job->system_time = $time;
|
||||
$job->save();
|
||||
|
||||
//Put our task in this section
|
||||
|
||||
//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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,15 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('services:corpjournal')->everyFifteenMinutes()->withoutOverlapping();
|
||||
//$schedule->command(GetCorps::class)->daily();
|
||||
$schedule->command('services:corpjournal')
|
||||
->everyHour()
|
||||
->withoutOverlapping();
|
||||
$schedule->command('services:getcorps')
|
||||
->everyDay()
|
||||
->withoutOverlapping();
|
||||
//$schedule->command('services:sendmail')
|
||||
// ->monthlyOn(1, '09:00')
|
||||
// ->withoutOverlapping();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user