find moon ore in importalliancemoons.php
This commit is contained in:
@@ -17,6 +17,7 @@ use DB;
|
|||||||
use Seat\Eseye\Exceptions\RequestFailedException;
|
use Seat\Eseye\Exceptions\RequestFailedException;
|
||||||
use App\Library\Esi\Esi;
|
use App\Library\Esi\Esi;
|
||||||
use App\Library\Helpers\LookupHelper;
|
use App\Library\Helpers\LookupHelper;
|
||||||
|
use App\Library\Moon\MoonCalc;
|
||||||
|
|
||||||
//Models
|
//Models
|
||||||
use App\Models\MoonRental\AllianceMoonOre;
|
use App\Models\MoonRental\AllianceMoonOre;
|
||||||
@@ -58,8 +59,9 @@ class ImportAllianceMoons extends Command
|
|||||||
///universe/moons/{moon_id}/
|
///universe/moons/{moon_id}/
|
||||||
//Declare variables
|
//Declare variables
|
||||||
$lookup = new LookupHelper;
|
$lookup = new LookupHelper;
|
||||||
|
$mHelper = new MoonCalc;
|
||||||
//Create the collection of lines for the input file.
|
//Create the collection of lines for the input file.
|
||||||
$moons = new Collection;
|
$moons = new Collection;
|
||||||
|
|
||||||
//Create the file handler
|
//Create the file handler
|
||||||
$data = Storage::get('public/alliance_moons.txt');
|
$data = Storage::get('public/alliance_moons.txt');
|
||||||
@@ -88,6 +90,8 @@ class ImportAllianceMoons extends Command
|
|||||||
$moonInfo = $lookup->GetMoonInfo($moon[6]);
|
$moonInfo = $lookup->GetMoonInfo($moon[6]);
|
||||||
$solarName = $lookup->SystemIdToName($moonInfo->system_id);
|
$solarName = $lookup->SystemIdToName($moonInfo->system_id);
|
||||||
|
|
||||||
|
$moonType = $mHelper->IsRMoonGoo($moon[1]);
|
||||||
|
|
||||||
if(AllianceMoon::where(['moon_id' => $moonInfo->moon_id])->count() == 0) {
|
if(AllianceMoon::where(['moon_id' => $moonInfo->moon_id])->count() == 0) {
|
||||||
//Save the moon into the database
|
//Save the moon into the database
|
||||||
$newMoon = new AllianceMoon;
|
$newMoon = new AllianceMoon;
|
||||||
@@ -95,10 +99,17 @@ class ImportAllianceMoons extends Command
|
|||||||
$newMoon->name = $moonInfo->name;
|
$newMoon->name = $moonInfo->name;
|
||||||
$newMoon->system_id = $moonInfo->system_id;
|
$newMoon->system_id = $moonInfo->system_id;
|
||||||
$newMoon->system_name = $solarName;
|
$newMoon->system_name = $solarName;
|
||||||
|
$newMoon->moon_type = $moonType;
|
||||||
$newMoon->worth_amount = 0.00;
|
$newMoon->worth_amount = 0.00;
|
||||||
$newMoon->rented = 'No';
|
$newMoon->rented = 'No';
|
||||||
$newMoon->rental_amount = 0.00;
|
$newMoon->rental_amount = 0.00;
|
||||||
$newMoon->save();
|
$newMoon->save();
|
||||||
|
} else {
|
||||||
|
AllianceMoon::where([
|
||||||
|
'moon_id' => $moonInfo->moon_id,
|
||||||
|
])->update([
|
||||||
|
'moon_type' => $moonType,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save a new entry into the database
|
//Save a new entry into the database
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TestController extends Controller
|
|||||||
|
|
||||||
//Pluck all the users from the database of ledgers to determine if they are mains or alts.
|
//Pluck all the users from the database of ledgers to determine if they are mains or alts.
|
||||||
$tempMains = Ledger::where([
|
$tempMains = Ledger::where([
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'Yes',
|
||||||
])->where('last_updated', '>', Carbon::now()->subDays(7))->pluck('character_id');
|
])->where('last_updated', '>', Carbon::now()->subDays(7))->pluck('character_id');
|
||||||
|
|
||||||
//Get the unique character ids from the ledgers in the previous statement
|
//Get the unique character ids from the ledgers in the previous statement
|
||||||
@@ -77,14 +77,14 @@ class TestController extends Controller
|
|||||||
//Count the ledgers for the main
|
//Count the ledgers for the main
|
||||||
$mainLedgerCount = Ledger::where([
|
$mainLedgerCount = Ledger::where([
|
||||||
'character_id' => $main,
|
'character_id' => $main,
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'Yes',
|
||||||
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
|
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
|
||||||
|
|
||||||
//If there are ledgers for the main, then let's grab them
|
//If there are ledgers for the main, then let's grab them
|
||||||
if($mainLedgerCount > 0) {
|
if($mainLedgerCount > 0) {
|
||||||
$mainLedgers = Ledger::where([
|
$mainLedgers = Ledger::where([
|
||||||
'character_id' => $main,
|
'character_id' => $main,
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'Yes',
|
||||||
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
|
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
|
||||||
|
|
||||||
//Cycle through the entries, and add them to the ledger to send with the invoice
|
//Cycle through the entries, and add them to the ledger to send with the invoice
|
||||||
@@ -114,13 +114,13 @@ class TestController extends Controller
|
|||||||
foreach($alts as $alt) {
|
foreach($alts as $alt) {
|
||||||
$altLedgerCount = Ledger::where([
|
$altLedgerCount = Ledger::where([
|
||||||
'character_id' => $alt->character_id,
|
'character_id' => $alt->character_id,
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'Yes',
|
||||||
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
|
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
|
||||||
|
|
||||||
if($altLedgerCount > 0) {
|
if($altLedgerCount > 0) {
|
||||||
$altLedgers = Ledger::where([
|
$altLedgers = Ledger::where([
|
||||||
'character_id' => $alt->character_id,
|
'character_id' => $alt->character_id,
|
||||||
'invoiced' => 'No',
|
'invoiced' => 'Yes',
|
||||||
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
|
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
|
||||||
|
|
||||||
foreach($altLedgers as $row) {
|
foreach($altLedgers as $row) {
|
||||||
|
|||||||
@@ -501,10 +501,10 @@ class MoonCalc {
|
|||||||
*/
|
*/
|
||||||
private function IsRMoonGoo($ore) {
|
private function IsRMoonGoo($ore) {
|
||||||
$ores = [
|
$ores = [
|
||||||
'Zeolites' => 'Gas',
|
'Zeolites' => 'R4',
|
||||||
'Sylvite' => 'Gas',
|
'Sylvite' => 'R4',
|
||||||
'Bitumens' => 'Gas',
|
'Bitumens' => 'R4',
|
||||||
'Coesite' => 'Gas',
|
'Coesite' => 'R4',
|
||||||
'Cobaltite' => 'R8',
|
'Cobaltite' => 'R8',
|
||||||
'Euxenite' => 'R8',
|
'Euxenite' => 'R8',
|
||||||
'Titanite' => 'R8',
|
'Titanite' => 'R8',
|
||||||
@@ -539,10 +539,10 @@ class MoonCalc {
|
|||||||
*/
|
*/
|
||||||
private function IsRMoonOre($ore) {
|
private function IsRMoonOre($ore) {
|
||||||
$ores = [
|
$ores = [
|
||||||
'Zeolites' => 'Gas',
|
'Zeolites' => 'R4',
|
||||||
'Sylvite' => 'Gas',
|
'Sylvite' => 'R4',
|
||||||
'Bitumens' => 'Gas',
|
'Bitumens' => 'R4',
|
||||||
'Coesite' => 'Gas',
|
'Coesite' => 'R4',
|
||||||
'Cobaltite' => 'R8',
|
'Cobaltite' => 'R8',
|
||||||
'Euxenite' => 'R8',
|
'Euxenite' => 'R8',
|
||||||
'Titanite' => 'R8',
|
'Titanite' => 'R8',
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ class CreateNewMoonRentalTables extends Migration
|
|||||||
$table->string('name')->default('Not Assigned');
|
$table->string('name')->default('Not Assigned');
|
||||||
$table->unsignedBigInteger('system_id');
|
$table->unsignedBigInteger('system_id');
|
||||||
$table->string('system_name')->default('Not Assigned');
|
$table->string('system_name')->default('Not Assigned');
|
||||||
|
$table->enum('moon_type', [
|
||||||
|
'R4',
|
||||||
|
'R8',
|
||||||
|
'R16',
|
||||||
|
'R32',
|
||||||
|
'R64',
|
||||||
|
'None',
|
||||||
|
])->default('None');
|
||||||
$table->decimal('worth_amount')->default(0.00);
|
$table->decimal('worth_amount')->default(0.00);
|
||||||
$table->enum('rented', [
|
$table->enum('rented', [
|
||||||
'No',
|
'No',
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
@section('content')
|
@section('content')
|
||||||
<br>
|
<br>
|
||||||
@foreach($bodies as $body)
|
@foreach($bodies as $body)
|
||||||
{{ $body }}<br>
|
{{ var_dump($body) }}<br>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endsection
|
@endsection
|
||||||
Reference in New Issue
Block a user