removed job models for eve mail as it's no longer needed. updated all functions to the new programming method
This commit is contained in:
@@ -15,7 +15,6 @@ use Commands\Library\CommandHelper;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\Flex\FlexStructure;
|
use App\Models\Flex\FlexStructure;
|
||||||
use App\Models\Mail\SentMail;
|
use App\Models\Mail\SentMail;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
class FlexStructureCommand extends Command
|
class FlexStructureCommand extends Command
|
||||||
{
|
{
|
||||||
@@ -93,19 +92,14 @@ class FlexStructureCommand extends Command
|
|||||||
$body .= "Warped Intentions Leadership<br>";
|
$body .= "Warped Intentions Leadership<br>";
|
||||||
|
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
$mail = new JobSendEveMail;
|
$subject = "Warped Intentions Flex Structures Payment Due for " . $today->englishMonth;
|
||||||
$mail->sender = $config['primary'];
|
ProcessSendEveMailJob::dispatch($body, (int)$structure->requestor_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
||||||
$mail->subject = "Warped Intentions Flex Structures Payment Due for " . $today->englishMonth;
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->recipient = (int)$structure->requestor_id;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
|
||||||
|
|
||||||
//Increment the delay for the mail to not hit the rate limits
|
//Increment the delay for the mail to not hit the rate limits
|
||||||
$delay += 60;
|
$delay += 60;
|
||||||
|
|
||||||
//After the mail is dispatched, save the sent mail record
|
//After the mail is dispatched, save the sent mail record
|
||||||
$this->SaveSentRecord($mail->sender, $mail->subject, $mail->body, $mail->recipient, $mail->recipient_type);
|
$this->SaveSentRecord($config['primary'], $subject, $body, (int)$structure->requestor_id, 'character');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mark the job as finished
|
//Mark the job as finished
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\Moon\RentalMoon;
|
use App\Models\Moon\RentalMoon;
|
||||||
use App\Models\MoonRent\MoonRental;
|
use App\Models\MoonRent\MoonRental;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
use App\Models\Mail\SentMail;
|
use App\Models\Mail\SentMail;
|
||||||
|
|
||||||
class MoonMailerCommand extends Command
|
class MoonMailerCommand extends Command
|
||||||
@@ -101,13 +100,8 @@ class MoonMailerCommand extends Command
|
|||||||
$body .= "Warped Intentions Leadership<br>";
|
$body .= "Warped Intentions Leadership<br>";
|
||||||
|
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
$mail = new JobSendEveMail;
|
$subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth;
|
||||||
$mail->sender = $config['primary'];
|
ProcessSendEveMailJob::dispatch($body, (int)$contact->Contact, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
||||||
$mail->subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth;
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->recipient = (int)$contact->Contact;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
|
||||||
//Increment the delay for the mail to not hit rate limits
|
//Increment the delay for the mail to not hit rate limits
|
||||||
$delay += 30;
|
$delay += 30;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ use App\Models\User\UserPermission;
|
|||||||
use App\Models\Contracts\Contract;
|
use App\Models\Contracts\Contract;
|
||||||
use App\Models\Contracts\Bid;
|
use App\Models\Contracts\Bid;
|
||||||
use App\Models\Contracts\AcceptedBid;
|
use App\Models\Contracts\AcceptedBid;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
class ContractAdminController extends Controller
|
class ContractAdminController extends Controller
|
||||||
{
|
{
|
||||||
@@ -152,15 +151,8 @@ class ContractAdminController extends Controller
|
|||||||
$body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.';
|
$body .= 'Please remit contract when the items are ready to Spatial Forces. Description should be the contract identification number. Request ISK should be the bid amount.';
|
||||||
$body .= 'Sincerely,<br>Spatial Forces Contracting Department';
|
$body .= 'Sincerely,<br>Spatial Forces Contracting Department';
|
||||||
|
|
||||||
//Setup the mail job
|
|
||||||
$mail = new JobSendEveMail;
|
|
||||||
$mail->subject = $subject;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
$mail->recipient = $bid['character_id'];
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->sender = $config['primary'];
|
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
ProcessSendEveMailJob::dispatch($body, $bid['character_id'], 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
||||||
|
|
||||||
//Tidy up the contract by doing a few things.
|
//Tidy up the contract by doing a few things.
|
||||||
$this->TidyContract($contract, $bid);
|
$this->TidyContract($contract, $bid);
|
||||||
@@ -187,12 +179,8 @@ class ContractAdminController extends Controller
|
|||||||
//Get the esi config
|
//Get the esi config
|
||||||
$config = config('esi');
|
$config = config('esi');
|
||||||
|
|
||||||
$mail = new JobSendEveMail;
|
$subject = 'New Alliance Production Contract Available';
|
||||||
$mail->sender = $config['primary'];
|
$body = "A new contract is available for the alliance contracting system. Please check out <a href='https://services.w4rp.space'>Services Site</a> if you want to bid on the production contract.<br><br>Sincerely,<br>Warped Intentions Leadership";
|
||||||
$mail->subject = 'New Alliance Production Contract Available';
|
ProcessSendEveMailJob::dispatch($body, $config['alliance'], 'alliance', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
||||||
$mail->recipient = $config['alliance'];
|
|
||||||
$mail->recipient_type = 'alliance';
|
|
||||||
$mail->body = "A new contract is available for the alliance contracting system. Please check out <a href='https://services.w4rp.space'>Services Site</a> if you want to bid on the production contract.<br><br>Sincerely,<br>Warped Intentions Leadership";
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use Log;
|
|||||||
|
|
||||||
//Models
|
//Models
|
||||||
use App\Models\Logistics\AnchorStructure;
|
use App\Models\Logistics\AnchorStructure;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
class StructureRequestAdminController extends Controller
|
class StructureRequestAdminController extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ use App\Library\Lookups\LookupHelper;
|
|||||||
|
|
||||||
//Models
|
//Models
|
||||||
use App\Models\Logistics\AnchorStructure;
|
use App\Models\Logistics\AnchorStructure;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
use App\Models\User\UserPermission;
|
use App\Models\User\UserPermission;
|
||||||
|
|
||||||
class StructureRequestController extends Controller
|
class StructureRequestController extends Controller
|
||||||
@@ -72,13 +71,8 @@ class StructureRequestController extends Controller
|
|||||||
$body .= "Warped Intentions Leadership<br>";
|
$body .= "Warped Intentions Leadership<br>";
|
||||||
|
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
$mail = new JobSendEveMail;
|
$subject = "New Structure Anchor Request";
|
||||||
$mail->sender = $config['primary'];
|
ProcessSendEveMailJob::dispatch($body, (int)$fc->character_id, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
||||||
$mail->subject = "New Structure Anchor Request";
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->recipient = (int)$fc->character_id;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($delay));
|
|
||||||
|
|
||||||
$delay += 15;
|
$delay += 15;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use App\Models\Moon\Price;
|
|||||||
use App\Models\MoonRent\MoonRental;
|
use App\Models\MoonRent\MoonRental;
|
||||||
use App\Models\Moon\AllianceMoon;
|
use App\Models\Moon\AllianceMoon;
|
||||||
use App\Models\Moon\AllianceMoonRequest;
|
use App\Models\Moon\AllianceMoonRequest;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
//Library
|
//Library
|
||||||
use App\Library\Moons\MoonCalc;
|
use App\Library\Moons\MoonCalc;
|
||||||
@@ -130,13 +129,7 @@ class MoonsAdminController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Setup the mail model
|
//Setup the mail model
|
||||||
$mail = new JobSendEveMail;
|
ProcessSendEveMailJob::dispatch($body, (int)$moon->requestor_id, 'character', 'Warped Intentions Moon Request', $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
||||||
$mail->sender = $config['primary'];
|
|
||||||
$mail->subject = 'Warped Intentions Moon Request';
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->recipient = (int)$moon->requestor_id;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
|
||||||
|
|
||||||
return redirect('/moons/admin/display/request')->with('success', 'Moon has been processed, and mail has been sent out.');
|
return redirect('/moons/admin/display/request')->with('success', 'Moon has been processed, and mail has been sent out.');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\Moon\RentalMoon;
|
use App\Models\Moon\RentalMoon;
|
||||||
use App\Models\MoonRent\MoonRental;
|
use App\Models\MoonRent\MoonRental;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
use App\Models\Mail\SentMail;
|
use App\Models\Mail\SentMail;
|
||||||
|
|
||||||
class MoonRentalInvoiceCreate implements ShouldQueue
|
class MoonRentalInvoiceCreate implements ShouldQueue
|
||||||
@@ -117,13 +116,8 @@ class MoonRentalInvoiceCreate implements ShouldQueue
|
|||||||
|
|
||||||
|
|
||||||
//Dispatch a new mail job
|
//Dispatch a new mail job
|
||||||
$mail = new JobSendEveMail;
|
$subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth;
|
||||||
$mail->sender = $config['primary'];
|
ProcessSendEveMailJob::dispatch($body, (int)$contact->Contact, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay));
|
||||||
$mail->subject = "Warped Intentions Moon Rental Payment Due for " . $today->englishMonth;
|
|
||||||
$mail->body = $body;
|
|
||||||
$mail->recipient = (int)$contact->Contact;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds($this->delay));
|
|
||||||
|
|
||||||
MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons');
|
MoonRentalUpdate::dispatch($this->rentals)->onQueue('moons');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ use App\Models\Esi\EsiScope;
|
|||||||
use App\Models\Esi\EsiToken;
|
use App\Models\Esi\EsiToken;
|
||||||
use App\Models\Jobs\JobStatus;
|
use App\Models\Jobs\JobStatus;
|
||||||
use App\Models\Mail\SentMail;
|
use App\Models\Mail\SentMail;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
class ProcessSendEveMailJob implements ShouldQueue
|
class ProcessSendEveMailJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
@@ -53,12 +52,12 @@ class ProcessSendEveMailJob implements ShouldQueue
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(JobSendEveMail $mail) {
|
public function __construct($body, $recipient, $recipient_type, $subject, $sender) {
|
||||||
$this->body = $mail->body;
|
$this->body = $body;
|
||||||
$this->recipient = $mail->recipient;
|
$this->recipient = $recipient;
|
||||||
$this->recipient_type = $mail->recipient_type;
|
$this->recipient_type = $recipient_type;
|
||||||
$this->subject = $mail->subject;
|
$this->subject = $subject;
|
||||||
$this->sender = $mail->sender;
|
$this->sender = $sender;
|
||||||
|
|
||||||
$this->connection = 'redis';
|
$this->connection = 'redis';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ use Carbon\Carbon;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\Esi\EsiToken;
|
use App\Models\Esi\EsiToken;
|
||||||
use App\Models\Esi\EsiScope;
|
use App\Models\Esi\EsiScope;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
//Jobs
|
//Jobs
|
||||||
use App\Jobs\ProcessSendEveMailJob;
|
use App\Jobs\ProcessSendEveMailJob;
|
||||||
@@ -41,14 +40,10 @@ class Esi {
|
|||||||
$check = EsiScope::where(['character_id' => $charId, 'scope' => $scope])->count();
|
$check = EsiScope::where(['character_id' => $charId, 'scope' => $scope])->count();
|
||||||
if($check == 0) {
|
if($check == 0) {
|
||||||
//Compose a mail to send to the user if the scope is not found
|
//Compose a mail to send to the user if the scope is not found
|
||||||
$mail = new JobSendEveMail;
|
$subject = 'W4RP Services - Incorrect ESI Scope';
|
||||||
$mail->sender = $config['primary'];
|
$body = "Please register on https://services.w4rp.space with the scope: " . $scope;
|
||||||
$mail->subject = 'W4RP Services - Incorrect ESI Scope';
|
|
||||||
$mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope;
|
|
||||||
$mail->recipient = (int)$charId;
|
|
||||||
$mail->recipient_type = 'character';
|
|
||||||
|
|
||||||
ProcessSendEveMailJob::dispatch($mail)->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
ProcessSendEveMailJob::dispatch($body, (int)$charId, 'character', $subject, $config['primary'])->onQueue('mail')->delay(Carbon::now()->addSeconds(5));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ use App\Jobs\ProcessSendEveMailJob;
|
|||||||
//Models
|
//Models
|
||||||
use App\Models\Esi\EsiToken;
|
use App\Models\Esi\EsiToken;
|
||||||
use App\Models\Esi\EsiScope;
|
use App\Models\Esi\EsiScope;
|
||||||
use App\Models\Jobs\JobSendEveMail;
|
|
||||||
|
|
||||||
//Library
|
//Library
|
||||||
use App\Library\Esi\Esi;
|
use App\Library\Esi\Esi;
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Jobs;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class JobSendEveMail extends Model
|
|
||||||
{
|
|
||||||
//Timestamps
|
|
||||||
public $timestamps = false;
|
|
||||||
|
|
||||||
protected $fillable = [
|
|
||||||
'sender',
|
|
||||||
'recipient',
|
|
||||||
'recipient_type',
|
|
||||||
'subject',
|
|
||||||
'body',
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user