tweaked some jobs
This commit is contained in:
@@ -51,7 +51,7 @@ class MiningTaxesDataCleanup extends Command
|
|||||||
$task->SetStartStatus();
|
$task->SetStartStatus();
|
||||||
|
|
||||||
//Clean up old data
|
//Clean up old data
|
||||||
Ledger::where(['updated_at', '<', Carbon::now()->subDays(120)])->delete();
|
Ledger::where(['updated_at', '<', Carbon::now()->subDays(90)])->delete();
|
||||||
|
|
||||||
//Set the task as finished
|
//Set the task as finished
|
||||||
$task->SetStopStatus();
|
$task->SetStopStatus();
|
||||||
|
|||||||
@@ -134,6 +134,18 @@ class MiningTaxesInvoices extends Command
|
|||||||
$body .= "<br>";
|
$body .= "<br>";
|
||||||
$body .= "<br>Sincerely,<br>Warped Intentions Leadership<br>";
|
$body .= "<br>Sincerely,<br>Warped Intentions Leadership<br>";
|
||||||
|
|
||||||
|
//Check if the mail body is greater than 2000 characters. If greater than 2,000 characters, then
|
||||||
|
if(sizeof($body) > 2000) {
|
||||||
|
$body = "Dear Miner,<br><br>";
|
||||||
|
$body .= "Total Value of Ore Mined: " . number_format($totalPrice, 2, ".", ",") . " ISK.";
|
||||||
|
$body .= "<br><br>";
|
||||||
|
$body .= "Please remit " . number_format($invoiceAmount, 2, ".", ",") . " ISK to Spatial Forces by " . $dateDue . "<br>";
|
||||||
|
$body .= "Set the reason for transfer as MMT: " . $invoiceId . "<br>";
|
||||||
|
$body .= "The mining taxes are currently set to " . $numberMiningTax . "%.<br>";
|
||||||
|
$body .= "<br>";
|
||||||
|
$body .= "<br>Sincerely,<br>Warped Intentions Leadership<br>";
|
||||||
|
}
|
||||||
|
|
||||||
//Mail the invoice to the character if the character is in
|
//Mail the invoice to the character if the character is in
|
||||||
//Warped Intentions or Legacy
|
//Warped Intentions or Legacy
|
||||||
$subject = 'Warped Intentions Mining Taxes';
|
$subject = 'Warped Intentions Mining Taxes';
|
||||||
|
|||||||
@@ -125,40 +125,46 @@ class ProcessSendEveMailJob implements ShouldQueue
|
|||||||
|
|
||||||
switch($errorCode) {
|
switch($errorCode) {
|
||||||
case 400: //Bad Request
|
case 400: //Bad Request
|
||||||
$this->release(15);
|
Log::critical("Bad request has occurred in ProcessSendEveMailJob. Job has been discarded");
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 401: //Unauthorized Request
|
case 401: //Unauthorized Request
|
||||||
$this->release(15);
|
Log::critical("Unauthorized request has occurred in ProcessSendEveMailJob at " . Carbon::now()->toDateTimeString() . ".\r\nCancelling the job.");
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 403: //Forbidden
|
case 403: //Forbidden
|
||||||
$this->release(15);
|
Log::critical("ProcessSendEveMailJob has incurred a forbidden error. Cancelling the job.");
|
||||||
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 420: //Error Limited
|
case 420: //Error Limited
|
||||||
Log::warning("Error rate limit occurred in ProcessSendEveMailJob. Restarting job in 120 seconds.");
|
Log::warning("Error rate limit occurred in ProcessSendEveMailJob. Restarting job in 120 seconds.");
|
||||||
$this->release(120);
|
$this->release(120);
|
||||||
break;
|
break;
|
||||||
case 500: //Internal Server Error
|
case 500: //Internal Server Error
|
||||||
Log::critical("Internal Server Error for ESI in ProcessSendEveMailJob");
|
Log::critical("Internal Server Error for ESI in ProcessSendEveMailJob. Attempting a restart in 120 seconds.");
|
||||||
return 0;
|
$this->release(120);
|
||||||
break;
|
break;
|
||||||
case 503: //Service Unavailable
|
case 503: //Service Unavailable
|
||||||
Log::critical("Service Unavailabe for ESI in ProcessSendEveMailJob");
|
Log::critical("Service Unavailabe for ESI in ProcessSendEveMailJob. Releasing the job back to the queue in 30 seconds.");
|
||||||
$this->release(15);
|
$this->release(30);
|
||||||
break;
|
break;
|
||||||
case 504: //Gateway Timeout
|
case 504: //Gateway Timeout
|
||||||
Log::critical("Gateway timeout in ProcessSendEveMailJob");
|
Log::critical("Gateway timeout in ProcessSendEveMailJob. Releasing the job back to the queue in 30 seconds.");
|
||||||
$this->release(15);
|
$this->release(30);
|
||||||
break;
|
break;
|
||||||
case 520: //Internal Error -- Mostly comes when rate limited hit
|
case 520: //Internal Error -- Mostly comes when rate limited hit
|
||||||
$this->release(15);
|
Log::warning("Rate limit hit for ProcessSendEveMailJob. Releasing the job back to the queue in 30 seconds.");
|
||||||
|
$this->release(30);
|
||||||
|
break;
|
||||||
|
case 201:
|
||||||
|
$this->SaveSentRecord($this->sender, $this->subject, $this->body, $this->recipient, $this->recipient_type);
|
||||||
|
$this->delete();
|
||||||
break;
|
break;
|
||||||
default: //If not an error, then just break out of the switch statement
|
default: //If not an error, then just break out of the switch statement
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->SaveSentRecord($this->sender, $this->subject, $this->body, $this->recipient, $this->recipient_type);
|
return 0;
|
||||||
|
|
||||||
$this->delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ class ProcessMiningTaxesLedgersJob implements ShouldQueue
|
|||||||
$mHelper = new MoonCalc;
|
$mHelper = new MoonCalc;
|
||||||
$config = config('esi');
|
$config = config('esi');
|
||||||
|
|
||||||
|
//Create a starting date for the ledger
|
||||||
|
$ledgerDate = Carbon::createFromFormat('Y-m-d', $this->ledger->last_updated);
|
||||||
|
|
||||||
|
//If the ledger is more than one day old, then process it, otherwise, we don't process it
|
||||||
|
//or add it to the database as it may still be updating.
|
||||||
|
if($ledgerDate->lessThan(Carbon::now()->subDay())) {
|
||||||
//Get some of the basic information we need to work with
|
//Get some of the basic information we need to work with
|
||||||
$charName = $lookup->CharacterIdToName($this->ledger->character_id);
|
$charName = $lookup->CharacterIdToName($this->ledger->character_id);
|
||||||
//Get the type name from the ledger ore
|
//Get the type name from the ledger ore
|
||||||
@@ -93,12 +99,7 @@ class ProcessMiningTaxesLedgersJob implements ShouldQueue
|
|||||||
'quantity' => $this->ledger->quantity,
|
'quantity' => $this->ledger->quantity,
|
||||||
'last_updated' => $this->ledger->last_updated,
|
'last_updated' => $this->ledger->last_updated,
|
||||||
])->update([
|
])->update([
|
||||||
'character_id' => $this->ledger->character_id,
|
|
||||||
'character_name' => $charName,
|
|
||||||
'observer_id' => $this->observerId,
|
|
||||||
'last_updated' => $this->ledger->last_updated,
|
'last_updated' => $this->ledger->last_updated,
|
||||||
'type_id' => $this->ledger->type_id,
|
|
||||||
'ore_name' => $typeName,
|
|
||||||
'quantity' => $this->ledger->quantity,
|
'quantity' => $this->ledger->quantity,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
]);
|
]);
|
||||||
@@ -115,4 +116,7 @@ class ProcessMiningTaxesLedgersJob implements ShouldQueue
|
|||||||
$ledg->save();
|
$ledg->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user