updated rental moon command with the correct job calls in the right order
updated the horizon redis configuration to add new processes and a new job queue called moons for the new moon rental coding
This commit is contained in:
71
app/Console/Commands/Moons/RentalMoonCommand.php
Normal file
71
app/Console/Commands/Moons/RentalMoonCommand.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Moons;
|
||||
|
||||
//Internal Library
|
||||
use Illuminate\Console\Command;
|
||||
use Carbon\Carbon;
|
||||
use Log;
|
||||
|
||||
//Jobs
|
||||
use App\Jobs\ProcessSendEveMailJob;
|
||||
use App\Jobs\Commands\Moons\MoonRentalInvoiceCreate;
|
||||
|
||||
//Library
|
||||
use Commands\Library\CommandHelper;
|
||||
|
||||
//Models
|
||||
use App\Models\Moon\MoonRental;
|
||||
|
||||
class RentalMoonCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'services:RentalMoons';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Rental Moons jobs';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Declare variables
|
||||
$delay = 0;
|
||||
|
||||
//Create the new command helper container
|
||||
$task = new CommandHelper('RentalMoonCommand');
|
||||
//Add the entry saying the job has started
|
||||
$task->SetStartStatus();
|
||||
|
||||
//Get all of the contacts from the rentals group
|
||||
$contacts = MoonRental::select('Contact')->groupBy('Contact')->get();
|
||||
|
||||
foreach($contacts as $contact) {
|
||||
MoonrentalInvoiceCreate::dispatch($contact, $delay)->onQueue('moons');
|
||||
}
|
||||
|
||||
//Set the job as completed
|
||||
$task->SetStopStatus();
|
||||
}
|
||||
}
|
||||
@@ -113,6 +113,9 @@ class MoonRentalInvoiceCreate implements ShouldQueue
|
||||
$body .= "Sincerely,<br>";
|
||||
$body .= "Warped Intentions Leadership<br>";
|
||||
|
||||
//Create the moon invoice and save it to the database
|
||||
|
||||
|
||||
//Dispatch a new mail job
|
||||
$mail = new JobSendEveMail;
|
||||
$mail->sender = $config['primary'];
|
||||
@@ -122,7 +125,7 @@ class MoonRentalInvoiceCreate implements ShouldQueue
|
||||
$mail->recipient_type = 'character';
|
||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay));
|
||||
|
||||
MoonRentalUpdate::dispatch($this->rentals);
|
||||
MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons');
|
||||
}
|
||||
|
||||
private function TotalizeMoonCost() {
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Commands\Moons;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class MoonRentalPaymentJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -148,9 +148,10 @@ return [
|
||||
'mail',
|
||||
'structures',
|
||||
'assets',
|
||||
'moons',
|
||||
],
|
||||
'balance' => 'auto',
|
||||
'processes' => 10,
|
||||
'processes' => 12,
|
||||
'tries' => 3,
|
||||
],
|
||||
],
|
||||
@@ -164,9 +165,10 @@ return [
|
||||
'mail',
|
||||
'structures',
|
||||
'assets',
|
||||
'moons',
|
||||
],
|
||||
'balance' => 'auto',
|
||||
'processes' => 10,
|
||||
'processes' => 12,
|
||||
'tries' => 3,
|
||||
],
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user