diff --git a/app/Console/Commands/corpJournal.php b/app/Console/Commands/corpJournal.php index 3c465acfc..2efdc2f98 100644 --- a/app/Console/Commands/corpJournal.php +++ b/app/Console/Commands/corpJournal.php @@ -4,6 +4,10 @@ namespace App\Console\Commands; use Illuminate\Console\Command; +use DB; + +use App\Library\Finances; + class corpJournal extends Command { /** @@ -37,6 +41,11 @@ class corpJournal extends Command */ public function handle() { - // + //Get the characters that have the esi-wallet.read_corporation_wallets.v1 + //esi wallet scope + $characters = DB::table('EsiScopes')->where('scopes', 'esi-wallet.read_corporation_wallets.v1')->get(); + foreach($characters as $char) { + + } } } diff --git a/app/Console/Commands/getCorps.php b/app/Console/Commands/getCorps.php index d8220d723..d6089cd7b 100644 --- a/app/Console/Commands/getCorps.php +++ b/app/Console/Commands/getCorps.php @@ -4,6 +4,13 @@ namespace App\Console\Commands; use Illuminate\Console\Command; +use App\Models\AllianceCorp; + +use Seat\Eseye\Cache\NullCache; +use Seat\Eseye\Configuration; +use Seat\Eseye\Containers\EsiAuthentication; +use Seat\Eseye\Eseye; + class getCorps extends Command { /** @@ -37,6 +44,33 @@ class getCorps extends Command */ public function handle() { - // + //Set the parameters for ESI + $configuration = Configuration::getInstance(); + $configuration->logfile_location = 'var/www/w4rpservices/storage/logs/eseye'; + //Create the ESI container + $esi = new Eseye(); + //try the esi call to get all of the corporations in the alliance + try { + $corporations = $esi->invoke('get', '/alliances/{alliance_id}/corporations/', [ + 'alliance_id' => 99004116, + ]); + } catch(\Seat\Eseye\Exceptions\RequestFailedException $e){ + dd($e->getEsiResponse()); + } + //Delete all of the entries in the AllianceCorps table + DB::table('AllianceCorps')->delete(); + foreach($corporations as $corp) { + try { + $corpInfo = $esi->invoke('get', '/corporations/{corporation_id}/', [ + 'corporation_id' => $corp, + ]); + } catch(\Seat\Eseye\Exceptions\RequestFailedException $e) { + return $e->getEsiResponse(); + } + $entry = new AllianceCorp; + $entry->corporation_id = $corp; + $entry->name = $corpInfo->name; + $entry->save(); + } } } diff --git a/app/Http/Controllers/EsiScopeController.php b/app/Http/Controllers/EsiScopeController.php index ce537c20c..fdc2a4f8a 100644 --- a/app/Http/Controllers/EsiScopeController.php +++ b/app/Http/Controllers/EsiScopeController.php @@ -21,7 +21,11 @@ class EsiScopeController extends Controller } public function displayScopes() { - return view('scopes.select'); + //Get the ESI Scopes for the user + $scopes = DB::table('EsiScopes')->where('character_id', Auth::user()->character_id)->get(); + //We want to send the scopes to the page as pre-checked. + dd($scopes); + return view('scopes.select')->with('scopes', $scopes); } public function redirectToProvider(Request $request) { diff --git a/app/Library/Finances.php b/app/Library/Finances.php index 80a12b28d..88a15569d 100644 --- a/app/Library/Finances.php +++ b/app/Library/Finances.php @@ -110,8 +110,8 @@ class Finances { //Create the ESI authentication container $config = config('esi'); $authentication = new EsiAuthentication([ - 'client_id' => $config['esi']['client_id'], - 'secret' => $config['esi']['secret'], + 'client_id' => $config['client_id'], + 'secret' => $config['secret'], 'refresh_token' => $token[0]->refresh_token, ]); //Create the esi class variable @@ -142,8 +142,8 @@ class Finances { //Create the ESI authentication container $config = config('esi'); $authentication = new EsiAuthentication([ - 'client_id' => $config['esi']['client_id'], - 'secret' => $config['esi']['secret'], + 'client_id' => $config['client_id'], + 'secret' => $config['secret'], 'refresh_token' => $token[0]->refresh_token, ]); //Create the esi class variable diff --git a/app/Library/Fleet.php b/app/Library/Fleet.php index d05b343d0..a1bbdaba6 100644 --- a/app/Library/Fleet.php +++ b/app/Library/Fleet.php @@ -68,8 +68,8 @@ class Fleet { //Create the esi authentication container $config = config('esi'); $authentication = new \Seat\Eseye\Containers\EsiAuthentication([ - 'client_id' => $config['esi']['client_id'], - 'secret' => $config['esi']['secret'], + 'client_id' => $config['client_id'], + 'secret' => $config['secret'], 'refresh_token' => $token->refresh_token, ]); //Create the esi class @@ -98,8 +98,8 @@ class Fleet { //Create the ESI Call Container $config = config('esi'); $authentication = new \Seat\Eseye\Containers\EsiAuthentication([ - 'client_id' => $config['esi']['client_id'], - 'secret' => $config['esi']['secret'], + 'client_id' => $config['client_id'], + 'secret' => $config['secret'], 'refresh_token' => $token[0]->refresh_token, ]); $esi = new \Seat\Eseye\Eseye($authentication); diff --git a/app/Models/AllianceCorp.php b/app/Models/AllianceCorp.php index 30b35c5d2..3c02c2f11 100644 --- a/app/Models/AllianceCorp.php +++ b/app/Models/AllianceCorp.php @@ -23,5 +23,6 @@ class AllianceCorp extends Model */ protected $fillable = [ 'corporation_id', + 'name', ]; } diff --git a/cache/latest/alliances/99004116/corporations/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache b/cache/latest/alliances/99004116/corporations/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache new file mode 100644 index 000000000..d68e5a83b Binary files /dev/null and b/cache/latest/alliances/99004116/corporations/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache differ diff --git a/cache/latest/corporations/98287666/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache b/cache/latest/corporations/98287666/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache new file mode 100644 index 000000000..e097c53ca Binary files /dev/null and b/cache/latest/corporations/98287666/6b75e300c8f31570a767b0a29f519238ef1849dd/results.cache differ diff --git a/database/migrations/2018_11_18_224639_create_alliance_corps.php b/database/migrations/2018_11_18_224639_create_alliance_corps.php index f25ec7183..da3596d4c 100644 --- a/database/migrations/2018_11_18_224639_create_alliance_corps.php +++ b/database/migrations/2018_11_18_224639_create_alliance_corps.php @@ -16,6 +16,7 @@ class CreateAllianceCorps extends Migration if(!Schema::hasTable('AllianceCorps')) { Schema::create('AllianceCorps', function(Blueprint $table) { $table->integer('corporation_id')->unique(); + $table->string('name'); $table->timestamps(); }); } diff --git a/resources/views/scopes/select.blade.php b/resources/views/scopes/select.blade.php index 46bdb0d0e..dfd4ffc98 100644 --- a/resources/views/scopes/select.blade.php +++ b/resources/views/scopes/select.blade.php @@ -6,20 +6,36 @@
{{ Form::label('scopes[]', 'Public Data') }} {{ Form::checkbox('scopes[]', 'publicData') }} +
+
{{ Form::label('scopes[]', 'Write Fleet') }} {{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1') }} +
+
{{ Form::label('scopes[]', 'Read Fleet') }} {{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1') }} +
+
{{ Form::label('scopes[]', 'Read Location') }} {{ Form::checkbox('scopes[]', 'esi-location.read_location.v1') }} +
+
{{ Form::label('scopes[]', 'Write Mail') }} {{ Form::checkbox('scopes[]', 'esi-mail.send_mail.v1') }} +
+
{{ Form::label('scopes[]', 'Read Mail') }} {{ Form::label('scopes[]', 'esi-mail.read_mail.v1')}} +
+
{{ Form::label('scopes[]', 'Corporation Wallets') }} {{ Form::checkbox('scopes[]', 'esi-wallet.read_corporation_wallets.v1') }} +
+
{{ Form::label('scopes[]', 'Read Structures') }} {{ Form::checkbox('scopes[]', 'esi-corporations.read_structures.v1') }} +
+
{{ Form::label('scopes[]', 'Structure Markets') }} {{ Form::checkbox('scopes[]', 'esi-markets.structure_markets.v1') }}
diff --git a/var/www/w4rpservices/storage/logs/eseye/eseye-2018-11-19.log b/var/www/w4rpservices/storage/logs/eseye/eseye-2018-11-19.log new file mode 100644 index 000000000..07b9e9938 --- /dev/null +++ b/var/www/w4rpservices/storage/logs/eseye/eseye-2018-11-19.log @@ -0,0 +1,8 @@ +[2018-11-19 01:37:59] eseye.ERROR: [http 400, bad request] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.68s/] +[2018-11-19 01:38:16] eseye.ERROR: [http 400, bad request] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.62s/] +[2018-11-19 01:38:26] eseye.ERROR: [http 400, bad request] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.63s/] +[2018-11-19 01:38:50] eseye.ERROR: [http 400, bad request] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.63s/] +[2018-11-19 01:39:07] eseye.ERROR: [http 400, bad request] post -> https://login.eveonline.com/oauth/token/?grant_type=refresh_token [t/e: 0.50s/] +[2018-11-19 01:39:32] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/latest/alliances/99004116/corporations/?datasource=tranquility [t/e: 0.67s/100] +[2018-11-19 01:56:56] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/latest/alliances/99004116/corporations/?datasource=tranquility [t/e: 0.72s/100] +[2018-11-19 01:57:58] eseye.INFO: [http 200, ok] get -> https://esi.evetech.net/latest/corporations/98287666/?datasource=tranquility [t/e: 0.67s/100]