clone saver parameters and framework

This commit is contained in:
2019-01-19 00:53:18 -06:00
parent 5847c9f59a
commit 69f60b45ce
8 changed files with 194 additions and 48 deletions

View File

@@ -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 .
'<br>Market Taxes Owed: ' .
number_format($finalTaxes, 2, '.', ',') .
'<br>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);
}
*/
}

View File

@@ -0,0 +1,77 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use App\Jobs\SendEveMail;
use Commands\Library\CommandHelper;
use App\Library\Esi\Esi;
use App\Library\Esi\Mail;
use App\Library\Clones\CloneSaver;
use App\Models\Character\CharacterClone;
class runclonesaver extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'services:clonesaver';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Performs the functionality for clone saver';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//Create the command helper container
$task = new CommandHelper('CloneSaver');
//Add the entry into the jobs table saying the job is starting
$task->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.<br>Please be advised we believe you should change your clones due to your expensive implants.<br>Sincerely,<br>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
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\Esi\EsiScope;
use App\Models\Esi\EsiToken;
use App\Models\User\UserPermission;
use App\Models\User\UserRole;
class CloneSaverController extends Controller
{
//
}

View File

@@ -0,0 +1,35 @@
<?php
namespace App\Library\Clones;
use DB;
use App\Library\Esi\Esi;
class CloneSaver {
/**
* Check if the scope is in the database for the character
*
* @param charId
* @param scope1
* @param scope2
*
* @return true,false
*/
public function HaveScopes($charId) {
}
public function RunCloneSaver($charId){
}
private function GetLocation($charId) {
}
private function GetImplants($charId) {
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Models\Character;
use Illuminate\Database\Eloquent\Model;
class CharacterClone extends Model
{
// Table Name
public $table = 'clones';
// Timestamps
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'character_id',
'active',
];
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateClonesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if(!Schema::hasTable('clones')) {
Schema::create('clones', function (Blueprint $table) {
$table->increments('id');
$table->string('character_id');
$table->boolean('active');
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('clones');
}
}

View File

@@ -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',

View File

@@ -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',