find moon ore in importalliancemoons.php

This commit is contained in:
2021-05-31 20:35:31 +09:00
parent bce8363a53
commit 13e99bd4a9
5 changed files with 34 additions and 15 deletions

View File

@@ -17,6 +17,7 @@ use DB;
use Seat\Eseye\Exceptions\RequestFailedException;
use App\Library\Esi\Esi;
use App\Library\Helpers\LookupHelper;
use App\Library\Moon\MoonCalc;
//Models
use App\Models\MoonRental\AllianceMoonOre;
@@ -58,6 +59,7 @@ class ImportAllianceMoons extends Command
///universe/moons/{moon_id}/
//Declare variables
$lookup = new LookupHelper;
$mHelper = new MoonCalc;
//Create the collection of lines for the input file.
$moons = new Collection;
@@ -88,6 +90,8 @@ class ImportAllianceMoons extends Command
$moonInfo = $lookup->GetMoonInfo($moon[6]);
$solarName = $lookup->SystemIdToName($moonInfo->system_id);
$moonType = $mHelper->IsRMoonGoo($moon[1]);
if(AllianceMoon::where(['moon_id' => $moonInfo->moon_id])->count() == 0) {
//Save the moon into the database
$newMoon = new AllianceMoon;
@@ -95,10 +99,17 @@ class ImportAllianceMoons extends Command
$newMoon->name = $moonInfo->name;
$newMoon->system_id = $moonInfo->system_id;
$newMoon->system_name = $solarName;
$newMoon->moon_type = $moonType;
$newMoon->worth_amount = 0.00;
$newMoon->rented = 'No';
$newMoon->rental_amount = 0.00;
$newMoon->save();
} else {
AllianceMoon::where([
'moon_id' => $moonInfo->moon_id,
])->update([
'moon_type' => $moonType,
]);
}
//Save a new entry into the database

View File

@@ -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.
$tempMains = Ledger::where([
'invoiced' => 'No',
'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->pluck('character_id');
//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
$mainLedgerCount = Ledger::where([
'character_id' => $main,
'invoiced' => 'No',
'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
//If there are ledgers for the main, then let's grab them
if($mainLedgerCount > 0) {
$mainLedgers = Ledger::where([
'character_id' => $main,
'invoiced' => 'No',
'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
//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) {
$altLedgerCount = Ledger::where([
'character_id' => $alt->character_id,
'invoiced' => 'No',
'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->count();
if($altLedgerCount > 0) {
$altLedgers = Ledger::where([
'character_id' => $alt->character_id,
'invoiced' => 'No',
'invoiced' => 'Yes',
])->where('last_updated', '>', Carbon::now()->subDays(7))->get();
foreach($altLedgers as $row) {

View File

@@ -501,10 +501,10 @@ class MoonCalc {
*/
private function IsRMoonGoo($ore) {
$ores = [
'Zeolites' => 'Gas',
'Sylvite' => 'Gas',
'Bitumens' => 'Gas',
'Coesite' => 'Gas',
'Zeolites' => 'R4',
'Sylvite' => 'R4',
'Bitumens' => 'R4',
'Coesite' => 'R4',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',
@@ -539,10 +539,10 @@ class MoonCalc {
*/
private function IsRMoonOre($ore) {
$ores = [
'Zeolites' => 'Gas',
'Sylvite' => 'Gas',
'Bitumens' => 'Gas',
'Coesite' => 'Gas',
'Zeolites' => 'R4',
'Sylvite' => 'R4',
'Bitumens' => 'R4',
'Coesite' => 'R4',
'Cobaltite' => 'R8',
'Euxenite' => 'R8',
'Titanite' => 'R8',

View File

@@ -32,6 +32,14 @@ class CreateNewMoonRentalTables extends Migration
$table->string('name')->default('Not Assigned');
$table->unsignedBigInteger('system_id');
$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->enum('rented', [
'No',

View File

@@ -2,6 +2,6 @@
@section('content')
<br>
@foreach($bodies as $body)
{{ $body }}<br>
{{ var_dump($body) }}<br>
@endforeach
@endsection