scopes and other files

This commit is contained in:
2018-11-18 21:00:37 -06:00
parent 9a635faa4c
commit 4dbb1e3bb0
11 changed files with 84 additions and 11 deletions

View File

@@ -4,6 +4,10 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use DB;
use App\Library\Finances;
class corpJournal extends Command class corpJournal extends Command
{ {
/** /**
@@ -37,6 +41,11 @@ class corpJournal extends Command
*/ */
public function handle() 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) {
}
} }
} }

View File

@@ -4,6 +4,13 @@ namespace App\Console\Commands;
use Illuminate\Console\Command; 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 class getCorps extends Command
{ {
/** /**
@@ -37,6 +44,33 @@ class getCorps extends Command
*/ */
public function handle() 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();
}
} }
} }

View File

@@ -21,7 +21,11 @@ class EsiScopeController extends Controller
} }
public function displayScopes() { 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) { public function redirectToProvider(Request $request) {

View File

@@ -110,8 +110,8 @@ class Finances {
//Create the ESI authentication container //Create the ESI authentication container
$config = config('esi'); $config = config('esi');
$authentication = new EsiAuthentication([ $authentication = new EsiAuthentication([
'client_id' => $config['esi']['client_id'], 'client_id' => $config['client_id'],
'secret' => $config['esi']['secret'], 'secret' => $config['secret'],
'refresh_token' => $token[0]->refresh_token, 'refresh_token' => $token[0]->refresh_token,
]); ]);
//Create the esi class variable //Create the esi class variable
@@ -142,8 +142,8 @@ class Finances {
//Create the ESI authentication container //Create the ESI authentication container
$config = config('esi'); $config = config('esi');
$authentication = new EsiAuthentication([ $authentication = new EsiAuthentication([
'client_id' => $config['esi']['client_id'], 'client_id' => $config['client_id'],
'secret' => $config['esi']['secret'], 'secret' => $config['secret'],
'refresh_token' => $token[0]->refresh_token, 'refresh_token' => $token[0]->refresh_token,
]); ]);
//Create the esi class variable //Create the esi class variable

View File

@@ -68,8 +68,8 @@ class Fleet {
//Create the esi authentication container //Create the esi authentication container
$config = config('esi'); $config = config('esi');
$authentication = new \Seat\Eseye\Containers\EsiAuthentication([ $authentication = new \Seat\Eseye\Containers\EsiAuthentication([
'client_id' => $config['esi']['client_id'], 'client_id' => $config['client_id'],
'secret' => $config['esi']['secret'], 'secret' => $config['secret'],
'refresh_token' => $token->refresh_token, 'refresh_token' => $token->refresh_token,
]); ]);
//Create the esi class //Create the esi class
@@ -98,8 +98,8 @@ class Fleet {
//Create the ESI Call Container //Create the ESI Call Container
$config = config('esi'); $config = config('esi');
$authentication = new \Seat\Eseye\Containers\EsiAuthentication([ $authentication = new \Seat\Eseye\Containers\EsiAuthentication([
'client_id' => $config['esi']['client_id'], 'client_id' => $config['client_id'],
'secret' => $config['esi']['secret'], 'secret' => $config['secret'],
'refresh_token' => $token[0]->refresh_token, 'refresh_token' => $token[0]->refresh_token,
]); ]);
$esi = new \Seat\Eseye\Eseye($authentication); $esi = new \Seat\Eseye\Eseye($authentication);

View File

@@ -23,5 +23,6 @@ class AllianceCorp extends Model
*/ */
protected $fillable = [ protected $fillable = [
'corporation_id', 'corporation_id',
'name',
]; ];
} }

View File

@@ -16,6 +16,7 @@ class CreateAllianceCorps extends Migration
if(!Schema::hasTable('AllianceCorps')) { if(!Schema::hasTable('AllianceCorps')) {
Schema::create('AllianceCorps', function(Blueprint $table) { Schema::create('AllianceCorps', function(Blueprint $table) {
$table->integer('corporation_id')->unique(); $table->integer('corporation_id')->unique();
$table->string('name');
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@@ -6,20 +6,36 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Public Data') }} {{ Form::label('scopes[]', 'Public Data') }}
{{ Form::checkbox('scopes[]', 'publicData') }} {{ Form::checkbox('scopes[]', 'publicData') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Write Fleet') }} {{ Form::label('scopes[]', 'Write Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1') }} {{ Form::checkbox('scopes[]', 'esi-fleets.write_fleet.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Fleet') }} {{ Form::label('scopes[]', 'Read Fleet') }}
{{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1') }} {{ Form::checkbox('scopes[]', 'esi-fleets.read_fleet.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Location') }} {{ Form::label('scopes[]', 'Read Location') }}
{{ Form::checkbox('scopes[]', 'esi-location.read_location.v1') }} {{ Form::checkbox('scopes[]', 'esi-location.read_location.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Write Mail') }} {{ Form::label('scopes[]', 'Write Mail') }}
{{ Form::checkbox('scopes[]', 'esi-mail.send_mail.v1') }} {{ Form::checkbox('scopes[]', 'esi-mail.send_mail.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Mail') }} {{ Form::label('scopes[]', 'Read Mail') }}
{{ Form::label('scopes[]', 'esi-mail.read_mail.v1')}} {{ Form::label('scopes[]', 'esi-mail.read_mail.v1')}}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Corporation Wallets') }} {{ Form::label('scopes[]', 'Corporation Wallets') }}
{{ Form::checkbox('scopes[]', 'esi-wallet.read_corporation_wallets.v1') }} {{ Form::checkbox('scopes[]', 'esi-wallet.read_corporation_wallets.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Read Structures') }} {{ Form::label('scopes[]', 'Read Structures') }}
{{ Form::checkbox('scopes[]', 'esi-corporations.read_structures.v1') }} {{ Form::checkbox('scopes[]', 'esi-corporations.read_structures.v1') }}
</div>
<div class="form-group col-md-6">
{{ Form::label('scopes[]', 'Structure Markets') }} {{ Form::label('scopes[]', 'Structure Markets') }}
{{ Form::checkbox('scopes[]', 'esi-markets.structure_markets.v1') }} {{ Form::checkbox('scopes[]', 'esi-markets.structure_markets.v1') }}
</div> </div>

View File

@@ -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]