updated hardcoded character with env variable
This commit is contained in:
@@ -45,6 +45,7 @@ ESI_CLIENT_ID=e5848fea3618427a8ee0dccb6a04fc62
|
|||||||
ESI_SECRET_KEY=TdnNGRM8RTNSifZdaIc9yHTTkYPgYEEXHRIbT6oY
|
ESI_SECRET_KEY=TdnNGRM8RTNSifZdaIc9yHTTkYPgYEEXHRIbT6oY
|
||||||
ESI_USERAGENT='W4RP Services'
|
ESI_USERAGENT='W4RP Services'
|
||||||
ESI_CALLBACK_URI='http://services.w4rp.space/callback'
|
ESI_CALLBACK_URI='http://services.w4rp.space/callback'
|
||||||
|
ESI_PRIMARY_CHAR=93738489
|
||||||
|
|
||||||
EVEONLINE_CLIENT_ID=e5848fea3618427a8ee0dccb6a04fc62
|
EVEONLINE_CLIENT_ID=e5848fea3618427a8ee0dccb6a04fc62
|
||||||
EVEONLINE_CLIENT_SECRET=TdnNGRM8RTNSifZdaIc9yHTTkYPgYEEXHRIbT6oY
|
EVEONLINE_CLIENT_SECRET=TdnNGRM8RTNSifZdaIc9yHTTkYPgYEEXHRIbT6oY
|
||||||
|
|||||||
@@ -59,21 +59,23 @@ class GetAssetsCommand extends Command
|
|||||||
//Add the entry into the jobs table saying the job is starting
|
//Add the entry into the jobs table saying the job is starting
|
||||||
$task->SetStartStatus();
|
$task->SetStartStatus();
|
||||||
|
|
||||||
|
//Setup the esi authentication container
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Declare some variables
|
//Declare some variables
|
||||||
$charId = 93738849;
|
$charId = 93738849;
|
||||||
$corpId = 98287666;
|
$corpId = 98287666;
|
||||||
|
|
||||||
//ESI Scope Check
|
//ESI Scope Check
|
||||||
$esiHelper = new Esi();
|
$esiHelper = new Esi();
|
||||||
$assetScope = $esiHelper->HaveEsiScope(93738489, 'esi-assets.read_corporation_assets.v1');
|
$assetScope = $esiHelper->HaveEsiScope($config['primary'], 'esi-assets.read_corporation_assets.v1');
|
||||||
|
|
||||||
if($assetScope == false) {
|
if($assetScope == false) {
|
||||||
Log::critical("Scope check for esi failed.");
|
Log::critical("Scope check for esi failed.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setup the esi authentication container
|
|
||||||
$config = config('esi');
|
|
||||||
//Get the refresh token from the database
|
//Get the refresh token from the database
|
||||||
$token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']);
|
$token = EsiToken::where(['character_id' => $charId])->get(['refresh_token']);
|
||||||
$authentication = new EsiAuthentication([
|
$authentication = new EsiAuthentication([
|
||||||
|
|||||||
@@ -56,14 +56,17 @@ class HoldingFinancesCommand extends Command
|
|||||||
//Setup the Finances container
|
//Setup the Finances container
|
||||||
$finance = new FinanceHelper();
|
$finance = new FinanceHelper();
|
||||||
|
|
||||||
|
//Get the esi configuration
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Get the total pages for the journal for the holding corporation
|
//Get the total pages for the journal for the holding corporation
|
||||||
$pages = $finance->GetJournalPageCount(1, 93738489);
|
$pages = $finance->GetJournalPageCount(1, $config['primary']);
|
||||||
|
|
||||||
//Dispatch a single job for each page to process
|
//Dispatch a single job for each page to process
|
||||||
for($i = 1; $i <= $pages; $i++) {
|
for($i = 1; $i <= $pages; $i++) {
|
||||||
$job = new JobProcessWalletJournal;
|
$job = new JobProcessWalletJournal;
|
||||||
$job->division = 1;
|
$job->division = 1;
|
||||||
$job->charId = 93738489;
|
$job->charId = $config['primary'];
|
||||||
$job->page = $i;
|
$job->page = $i;
|
||||||
ProcessWalletJournalJob::dispatch($job)->onQueue('journal');
|
ProcessWalletJournalJob::dispatch($job)->onQueue('journal');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ class MoonMailerCommand extends Command
|
|||||||
$today->minute = 0;
|
$today->minute = 0;
|
||||||
$today->hour = 0;
|
$today->hour = 0;
|
||||||
|
|
||||||
|
//Get the esi configuration
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Get all contacts from the rentals group
|
//Get all contacts from the rentals group
|
||||||
$contacts = MoonRental::select('Contact')->groupBy('Contact')->get();
|
$contacts = MoonRental::select('Contact')->groupBy('Contact')->get();
|
||||||
|
|
||||||
@@ -99,7 +102,7 @@ class MoonMailerCommand extends Command
|
|||||||
|
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
$mail = new EveMail;
|
$mail = new EveMail;
|
||||||
$mail->sender = 93738489;
|
$mail->sender = $config['primary'];
|
||||||
$mail->subject = "Warped Intentions Moon Rental Payment Due";
|
$mail->subject = "Warped Intentions Moon Rental Payment Due";
|
||||||
$mail->body = $body;
|
$mail->body = $body;
|
||||||
$mail->recipient = (int)$contact->Contact;
|
$mail->recipient = (int)$contact->Contact;
|
||||||
|
|||||||
@@ -60,8 +60,11 @@ class GetStructuresCommand extends Command
|
|||||||
//Add the entry into the jobs table saying the job is starting
|
//Add the entry into the jobs table saying the job is starting
|
||||||
$task->SetStartStatus();
|
$task->SetStartStatus();
|
||||||
|
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Declare some variables
|
//Declare some variables
|
||||||
$charId = 93738489;
|
$charId = $config['primary'];
|
||||||
$corpId = 98287666;
|
$corpId = 98287666;
|
||||||
$sHelper = new StructureHelper($charId, $corpId);
|
$sHelper = new StructureHelper($charId, $corpId);
|
||||||
$structures = null;
|
$structures = null;
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ class ContractAdminController extends Controller
|
|||||||
$mail = new Mail;
|
$mail = new Mail;
|
||||||
$tries = 1;
|
$tries = 1;
|
||||||
|
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
$contract = Contract::where(['contract_id' => $request->contract_id])->first()->toArray();
|
$contract = Contract::where(['contract_id' => $request->contract_id])->first()->toArray();
|
||||||
$bid = Bid::where(['id' => $request->accept, 'contract_id' => $request->contract_id])->first()->toArray();
|
$bid = Bid::where(['id' => $request->accept, 'contract_id' => $request->contract_id])->first()->toArray();
|
||||||
|
|
||||||
@@ -158,7 +161,7 @@ class ContractAdminController extends Controller
|
|||||||
$mail->recipient_type = 'character';
|
$mail->recipient_type = 'character';
|
||||||
$mail->recipient = $bid['character_id'];
|
$mail->recipient = $bid['character_id'];
|
||||||
$mail->body = $body;
|
$mail->body = $body;
|
||||||
$mail->sender = 93738489;
|
$mail->sender = $config['primary'];
|
||||||
//Dispatch the mail job
|
//Dispatch the mail job
|
||||||
SendEveMailJob::dispatch($mail)->onQueue('mail');
|
SendEveMailJob::dispatch($mail)->onQueue('mail');
|
||||||
|
|
||||||
@@ -187,10 +190,13 @@ class ContractAdminController extends Controller
|
|||||||
//Get all the users with a specific permission set
|
//Get all the users with a specific permission set
|
||||||
$users = UserPermission::where(['permission' => 'contract.canbid'])->get()->toArray();
|
$users = UserPermission::where(['permission' => 'contract.canbid'])->get()->toArray();
|
||||||
|
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Cycle through the users with the correct permission and send a mail to go out with the queue system.
|
//Cycle through the users with the correct permission and send a mail to go out with the queue system.
|
||||||
foreach($users as $user) {
|
foreach($users as $user) {
|
||||||
$mail = new EveMail;
|
$mail = new EveMail;
|
||||||
$mail->sender = 93738489;
|
$mail->sender = $config['primary'];
|
||||||
$mail->subject = 'New Alliance Contract Available';
|
$mail->subject = 'New Alliance Contract Available';
|
||||||
$mail->recipient = $user['character_id'];
|
$mail->recipient = $user['character_id'];
|
||||||
$mail->recipient_type = 'character';
|
$mail->recipient_type = 'character';
|
||||||
|
|||||||
@@ -69,8 +69,11 @@ class SendEveMailJob implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
//Get the esi configuration
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Retrieve the token for main character to send mails from
|
//Retrieve the token for main character to send mails from
|
||||||
$token = EsiToken::where(['character_id'=> 93738489])->get();
|
$token = EsiToken::where(['character_id'=> $config['primary']])->get();
|
||||||
|
|
||||||
//Create the ESI authentication container
|
//Create the ESI authentication container
|
||||||
$config = config('esi');
|
$config = config('esi');
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ class Esi {
|
|||||||
* @return true,false
|
* @return true,false
|
||||||
*/
|
*/
|
||||||
public function HaveEsiScope($charId, $scope) {
|
public function HaveEsiScope($charId, $scope) {
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Check for an esi scope
|
//Check for an esi scope
|
||||||
$checks = DB::table('EsiScopes')->where('character_id', $charId)->get();
|
$checks = DB::table('EsiScopes')->where('character_id', $charId)->get();
|
||||||
foreach($checks as $check) {
|
foreach($checks as $check) {
|
||||||
@@ -44,7 +47,7 @@ class Esi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mail = new EveMail;
|
$mail = new EveMail;
|
||||||
$mail->sender = 93738489;
|
$mail->sender = $config['primary'];
|
||||||
$mail->subject = 'W4RP Services - Incorrect ESI Scope';
|
$mail->subject = 'W4RP Services - Incorrect ESI Scope';
|
||||||
$mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope;
|
$mail->body = "Please register on https://services.w4rp.space with the scope: " . $scope;
|
||||||
$mail->recipient = (int)$charId;
|
$mail->recipient = (int)$charId;
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
|||||||
class Mail {
|
class Mail {
|
||||||
|
|
||||||
public function SendMail($recipient, $rType, $subject, $body) {
|
public function SendMail($recipient, $rType, $subject, $body) {
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
//Retrieve the token for main character to send mails from
|
//Retrieve the token for main character to send mails from
|
||||||
$token = EsiToken::where(['character_id' => 93738489])->first();
|
$token = EsiToken::where(['character_id' => $config['primary']])->first();
|
||||||
//Create the ESI authentication container
|
//Create the ESI authentication container
|
||||||
$config = config('esi');
|
$config = config('esi');
|
||||||
$authentication = new EsiAuthentication([
|
$authentication = new EsiAuthentication([
|
||||||
@@ -36,7 +39,7 @@ class Mail {
|
|||||||
]],
|
]],
|
||||||
'subject' => $subject,
|
'subject' => $subject,
|
||||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||||
'character_id'=> 93738489,
|
'character_id'=> $config['primary'],
|
||||||
]);
|
]);
|
||||||
} catch(RequestFailedException $e) {
|
} catch(RequestFailedException $e) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -316,10 +316,14 @@ class FinanceHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function TokenNotFound($token, $scope, $charId) {
|
private function TokenNotFound($token, $scope, $charId) {
|
||||||
|
//Get the esi config
|
||||||
|
$config = config('esi');
|
||||||
|
|
||||||
|
|
||||||
if(!isset($token[0]->refresh_token) || !isset($scope[0]->scope)) {
|
if(!isset($token[0]->refresh_token) || !isset($scope[0]->scope)) {
|
||||||
//Register a mail to be dispatched as a job
|
//Register a mail to be dispatched as a job
|
||||||
$mail = new EveMail;
|
$mail = new EveMail;
|
||||||
$mail->sender = 93738489;
|
$mail->sender = $config['primary'];
|
||||||
$mail->subject = 'W4RP Services ESI API';
|
$mail->subject = 'W4RP Services ESI API';
|
||||||
$mail->body = 'You need to register an ESI API on the services site for esi-wallet.read_corporation_wallet.v1<br>This is also labeled Corporation Wallets';
|
$mail->body = 'You need to register an ESI API on the services site for esi-wallet.read_corporation_wallet.v1<br>This is also labeled Corporation Wallets';
|
||||||
$mail->recipient = (int)$charId;
|
$mail->recipient = (int)$charId;
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
'secret' => env('ESI_SECRET_KEY'),
|
'secret' => env('ESI_SECRET_KEY'),
|
||||||
'useragent' => env('ESI_USERAGENT'),
|
'useragent' => env('ESI_USERAGENT'),
|
||||||
'callback' => env('ESI_CALLBACK_URI'),
|
'callback' => env('ESI_CALLBACK_URI'),
|
||||||
|
'primary' => env('ESI_PRIMARY_CHAR'),
|
||||||
];
|
];
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user