From 69f60b45cef211c9108de77948629c88422768b4 Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Sat, 19 Jan 2019 00:53:18 -0600 Subject: [PATCH] clone saver parameters and framework --- app/Console/Commands/calculatemarkettax.php | 48 ------------ app/Console/Commands/runclonesaver.php | 77 +++++++++++++++++++ app/Http/Controllers/CloneSaverController.php | 18 +++++ app/Library/Clones/CloneSaver.php | 35 +++++++++ app/Models/Charcter/CharacterClone.php | 24 ++++++ .../2019_01_19_062656_create_clones_table.php | 36 +++++++++ vendor/composer/autoload_classmap.php | 2 + vendor/composer/autoload_static.php | 2 + 8 files changed, 194 insertions(+), 48 deletions(-) create mode 100644 app/Console/Commands/runclonesaver.php create mode 100644 app/Http/Controllers/CloneSaverController.php create mode 100644 app/Library/Clones/CloneSaver.php create mode 100644 app/Models/Charcter/CharacterClone.php create mode 100644 database/migrations/2019_01_19_062656_create_clones_table.php diff --git a/app/Console/Commands/calculatemarkettax.php b/app/Console/Commands/calculatemarkettax.php index 22cc63297..522439628 100644 --- a/app/Console/Commands/calculatemarkettax.php +++ b/app/Console/Commands/calculatemarkettax.php @@ -22,11 +22,6 @@ use App\Models\Mail\EveMail; use App\Models\Esi\EsiScope; use App\Models\Esi\EsiToken; -use Seat\Eseye\Cache\NullCache; -use Seat\Eseye\Configuration; -use Seat\Eseye\Containers\EsiAuthentication; -use Seat\Eseye\Eseye; - class CalculateMarketTax extends Command { /** @@ -113,49 +108,6 @@ class CalculateMarketTax extends Command //$mail->save(); SendEveMail::dispatch($mail); - - /* - - //Retrieve the token for main character to send mails from - $token = EsiToken::where(['character_id' => 93738489])->first(); - - //Create a new esi container and authentication - $config = config('esi'); - $authentication = new EsiAuthentication([ - 'client_id' => $config['client_id'], - 'secret' => $config['secret'], - 'refresh_token' => $token->refresh_token, - ]); - $esi = new Eseye($authentication); - - //Send a mail out with the bill - $subject = 'Market Taxes Owed'; - $body = 'Year ' . $start->year . ' ' . - 'Month: ' . - $start->month . - '
Market Taxes Owed: ' . - number_format($finalTaxes, 2, '.', ',') . - '
Please remit to Spatial Forces'; - try { - $this->line('Attemping to send the mail.'); - $esi->setBody([ - 'approved_cost' => 50000, - 'body' => $body, - 'recipients' => [[ - 'recipient_id' => (int)$info->character_id, - 'recipient_type' => 'character', - ]], - 'subject' => $subject, - ])->invoke('post', '/characters/{character_id}/mail/', [ - 'character_id'=> 93738489, - ]); - $this->line('Mail sent.'); - - } catch(RequestFailedException $e) { - $this->line('Error is ' . $e); - } - - */ } diff --git a/app/Console/Commands/runclonesaver.php b/app/Console/Commands/runclonesaver.php new file mode 100644 index 000000000..6bf8d6f51 --- /dev/null +++ b/app/Console/Commands/runclonesaver.php @@ -0,0 +1,77 @@ +SetStartStatus(); + + + + + + //Mark the job as finished + $task->SetStopStatus(); + } + + private function CloneSaverMail() { + //Store a new eve mail model for the job to dispatch + $mail = new EveMail; + $mail->sender = $self; + $mail->subject = 'Clone Saver Alert'; + $mail->body = 'You have failed to change clones before undocking.
Please be advised we believe you should change your clones due to your expensive implants.
Sincerely,
The Clone Saver Team'; + $mail->recipient = (int)$self; + $mail->recipient_type = 'character'; + + //Dispatch the job + SendEveMail::dispatch($mail); + + //Setup time frame job has been sent so we don't send too many mails all at once + + } +} diff --git a/app/Http/Controllers/CloneSaverController.php b/app/Http/Controllers/CloneSaverController.php new file mode 100644 index 000000000..591c19c6a --- /dev/null +++ b/app/Http/Controllers/CloneSaverController.php @@ -0,0 +1,18 @@ +increments('id'); + $table->string('character_id'); + $table->boolean('active'); + $table->timestamps(); + }); + } + + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('clones'); + } +} diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 0ebb21877..3b59cab44 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -25,6 +25,7 @@ return array( 'App\\Http\\Controllers\\Auth\\RegisterController' => $baseDir . '/app/Http/Controllers/Auth/RegisterController.php', 'App\\Http\\Controllers\\Auth\\ResetPasswordController' => $baseDir . '/app/Http/Controllers/Auth/ResetPasswordController.php', 'App\\Http\\Controllers\\Auth\\VerificationController' => $baseDir . '/app/Http/Controllers/Auth/VerificationController.php', + 'App\\Http\\Controllers\\CloneSaverController' => $baseDir . '/app/Http/Controllers/CloneSaverController.php', 'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php', 'App\\Http\\Controllers\\DashboardController' => $baseDir . '/app/Http/Controllers/DashboardController.php', 'App\\Http\\Controllers\\EsiScopeController' => $baseDir . '/app/Http/Controllers/EsiScopeController.php', @@ -69,6 +70,7 @@ return array( 'App\\Models\\Config' => $baseDir . '/app/Models/Config.php', 'App\\Models\\Corporation\\AllianceCorp' => $baseDir . '/app/Models/Corporation/AllianceCorp.php', 'App\\Models\\Corporation\\CorpStructure' => $baseDir . '/app/Models/Corporation/CorpStructure.php', + 'App\\Models\\Corporation\\CorpTaxRatio' => $baseDir . '/app/Models/Corporation/CorpTaxRatio.php', 'App\\Models\\Corporation\\CorporationToAlliance' => $baseDir . '/app/Models/Corporation/CorporationToAlliance.php', 'App\\Models\\Corporation\\HoldingCorpJournal' => $baseDir . '/app/Models/Corporation/HoldingCorpJournal.php', 'App\\Models\\Corporation\\Structure' => $baseDir . '/app/Models/Corporation/Structure.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 12989c70c..e834eadf4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -479,6 +479,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9 'App\\Http\\Controllers\\Auth\\RegisterController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/RegisterController.php', 'App\\Http\\Controllers\\Auth\\ResetPasswordController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/ResetPasswordController.php', 'App\\Http\\Controllers\\Auth\\VerificationController' => __DIR__ . '/../..' . '/app/Http/Controllers/Auth/VerificationController.php', + 'App\\Http\\Controllers\\CloneSaverController' => __DIR__ . '/../..' . '/app/Http/Controllers/CloneSaverController.php', 'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php', 'App\\Http\\Controllers\\DashboardController' => __DIR__ . '/../..' . '/app/Http/Controllers/DashboardController.php', 'App\\Http\\Controllers\\EsiScopeController' => __DIR__ . '/../..' . '/app/Http/Controllers/EsiScopeController.php', @@ -523,6 +524,7 @@ class ComposerStaticInitc3f953f8a7291d41a76e1664339777c9 'App\\Models\\Config' => __DIR__ . '/../..' . '/app/Models/Config.php', 'App\\Models\\Corporation\\AllianceCorp' => __DIR__ . '/../..' . '/app/Models/Corporation/AllianceCorp.php', 'App\\Models\\Corporation\\CorpStructure' => __DIR__ . '/../..' . '/app/Models/Corporation/CorpStructure.php', + 'App\\Models\\Corporation\\CorpTaxRatio' => __DIR__ . '/../..' . '/app/Models/Corporation/CorpTaxRatio.php', 'App\\Models\\Corporation\\CorporationToAlliance' => __DIR__ . '/../..' . '/app/Models/Corporation/CorporationToAlliance.php', 'App\\Models\\Corporation\\HoldingCorpJournal' => __DIR__ . '/../..' . '/app/Models/Corporation/HoldingCorpJournal.php', 'App\\Models\\Corporation\\Structure' => __DIR__ . '/../..' . '/app/Models/Corporation/Structure.php',