alliance journal stuff

This commit is contained in:
2019-08-04 01:22:49 -05:00
parent 4701abc691
commit 396d02e7a3
6 changed files with 102 additions and 16 deletions
@@ -13,15 +13,15 @@ use App\Library\Esi\Esi;
use App\Models\Finances\CorpMarketJournal;
class MarketTax {
class AllianceMarketTax {
public function InsertMarketTax($journal, $corpId, $division) {
//Create the ESI Helper class
$esiHelper = new Esi;
//Check to see if we can find the entry in the database already.
//If we don't then add it to the database
if(!CorpMarketJournal::where(['id' => $journal['id']])->exists()) {
$entry = new CorpMarketJournal;
if(!AllianceMarketJournal::where(['id' => $journal['id']])->exists()) {
$entry = new AllianceMarketJournal;
$entry->id = $journal['id'];
$entry->corporation_id = $corpId;
$entry->division = $division;
+7 -11
View File
@@ -72,7 +72,7 @@ class FinanceHelper {
try {
$journals = $esi->invoke('get', '/corporations/{corporation_id}/wallets/{division}/transactions/', [
'corporation_id' => 98287666,
'division' => 3,
'division' => 5,
]);
} catch(RequestFailedException $e) {
Log::critical($e->getEsiResponse());
@@ -85,7 +85,7 @@ class FinanceHelper {
//For each transactional entry, attempt to store it in the database.
//The PutWalletJournal function checks to see if it's already in the database.
foreach($wallet as $entry) {
if($division == 3 && $charId == 94415555) {
if($division == 5 && $charId == 94415555) {
if(in_array($entry['type_id'], $pi_items, false)) {
$pi = new PISale();
$pi->InsertPISale($entry, 98287666);
@@ -103,15 +103,13 @@ class FinanceHelper {
$industry = new StructureIndustryTax();
$office = new OfficeFee();
$esiHelper = new Esi();
$lookups = new LookupHelper;
//Get the ESI refresh token for the corporation to add new wallet journals into the database
$token = $esiHelper->GetToken($charId, 'esi-wallet.read_corporation_wallets.v1');
if($token == null) {
return null;
}
//Declare the lookup class helper
$lookups = new LookupHelper;
}
//Reference to see if the character is in our look up table for corporations and characters
$corpId = $lookups->LookupCharacter($charId);
@@ -269,7 +267,7 @@ class FinanceHelper {
public function GetWalletJournalPage($division, $charId, $page = 1) {
//Declare new class variables
$market = new MarketTax();
$market = new AllianceMarketTax();
$reprocessing = new ReprocessingTax();
$jb = new JumpBridgeTax();
$other = new PlayerDonation();
@@ -277,15 +275,13 @@ class FinanceHelper {
$office = new OfficeFee();
$pi = new PlanetProductionTax();
$esiHelper = new Esi();
$lookups = new LookupHelper;
//Get the ESI refresh token for the corporation to add new wallet journals into the database
$token = $esiHelper->GetToken($charId, 'esi-wallet.read_corporation_wallets.v1');
if($token == null) {
return null;
}
//Declare the lookup class helper
$lookups = new LookupHelper;
}
//Reference to see if the character is in our look up table for corporations and characters
$corpId = $lookups->LookupCorporationId($charId);
@@ -0,0 +1,41 @@
<?php
namespace App\Models\Finances;
use Illuminate\Database\Eloquent\Model;
class AllianceMarketJournal extends Model
{
/**
* Table Name
*/
protected $table = 'alliance_market_journal';
/**
* Timestamps
*/
public $timestamps = true;
/**
* The attributes that are mass assignable
*
* @var array
*/
protected $fillable = [
'id',
'corporation_id',
'division',
'amount',
'balance',
'context_id',
'context_id_type',
'date',
'description',
'first_party_id',
'reason',
'ref_type',
'second_party_id',
'tax',
'tax_receiver_id',
];
}