updated moon mailer to record mail sent when it's sent to eve api
This commit is contained in:
@@ -111,9 +111,6 @@ class MoonMailerCommand extends Command
|
||||
//Increment the delay for the mail to not hit rate limits
|
||||
$delay += 30;
|
||||
|
||||
//After the mail is dispatched, saved the sent mail record
|
||||
$this->SaveSentRecord($mail->sender, $mail->subject, $mail->body, $mail->recipient, $mail->recipient_type);
|
||||
|
||||
//Update the moon as not being paid for the next month?
|
||||
foreach($rentals as $rental) {
|
||||
$previous = new Carbon($rental->Paid_Until);
|
||||
@@ -138,16 +135,6 @@ class MoonMailerCommand extends Command
|
||||
]);
|
||||
}
|
||||
|
||||
private function SaveSentRecord($sender, $subject, $body, $recipient, $recipientType) {
|
||||
$sentmail = new SentMail;
|
||||
$sentmail->sender = $sender;
|
||||
$sentmail->subject = $subject;
|
||||
$sentmail->body = $body;
|
||||
$sentmail->recipient = $recipient;
|
||||
$sentmail->recipient_type = $recipientType;
|
||||
$sentmail->save();
|
||||
}
|
||||
|
||||
private function GetMoonList($moons) {
|
||||
//Declare the variable to be used as a global part of the function
|
||||
$list = array();
|
||||
|
||||
@@ -19,6 +19,7 @@ use App\Models\Esi\EsiScope;
|
||||
use App\Models\Esi\EsiToken;
|
||||
use App\Models\Mail\EveMail;
|
||||
use App\Models\Jobs\JobStatus;
|
||||
use App\Models\Mail\SentMail;
|
||||
|
||||
class ProcessSendEveMailJob implements ShouldQueue
|
||||
{
|
||||
@@ -38,6 +39,7 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
*/
|
||||
public $retries = 3;
|
||||
|
||||
private $sender;
|
||||
private $body;
|
||||
private $recipient;
|
||||
private $recipient_type;
|
||||
@@ -53,6 +55,7 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
$this->recipient = $mail->recipient;
|
||||
$this->recipient_type = $mail->recipient_type;
|
||||
$this->subject = $mail->subject;
|
||||
$this->sender = $mail->sender;
|
||||
|
||||
$this->connection = 'redis';
|
||||
}
|
||||
@@ -90,13 +93,15 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
]],
|
||||
'subject' => $this->subject,
|
||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||
'character_id'=> $config['primary'],
|
||||
'character_id'=> $this->sender,
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
Log::warning($e);
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->SaveSentRecord($this->sender, $this->subject, $this->body, $this->recipient, $this->recipient_type);
|
||||
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
@@ -110,4 +115,14 @@ class ProcessSendEveMailJob implements ShouldQueue
|
||||
{
|
||||
Log::critical($exception);
|
||||
}
|
||||
|
||||
private function SaveSentRecord($sender, $subject, $body, $recipient, $recipientType) {
|
||||
$sentmail = new SentMail;
|
||||
$sentmail->sender = $sender;
|
||||
$sentmail->subject = $subject;
|
||||
$sentmail->body = $body;
|
||||
$sentmail->recipient = $recipient;
|
||||
$sentmail->recipient_type = $recipientType;
|
||||
$sentmail->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user