This commit is contained in:
2018-11-22 23:03:48 -06:00
parent 3e90cb1474
commit b6c93c81e0
3 changed files with 20 additions and 1 deletions

View File

@@ -60,6 +60,7 @@ class CorpJournal extends Command
private function GetJournal($charId) {
$finances = new Finances();
//Get the master wallet journal for the corporation for the character
$finances->GetWalletJournal(1, $charId);
}
}

View File

@@ -66,6 +66,20 @@ class Esi {
return $character->corporation_name;
}
public function DecodeDate($date) {
//Find the end of the date
$dateEnd = strpos($date, "T");
//Split the string up into date and time
$dateArr = str_split($date, $dateEnd);
//Trim the T and Z from the end of the second item in the array
$dateArr[1] = ltrim($dateArr[1], "T");
$dateArr[1] = rtrim($dateArr[1], "Z");
//Combine the date
$realDate = $dateArr[0] . " " . $dateArr[1];
//Return the combined date in the correct format
return $realDate;
}
}
?>

View File

@@ -107,6 +107,10 @@ class Finances {
}
private function PutWalletJournal($journal, $corpId, $division) {
//Create ESI Helper class
$esiHelper = new Esi;
$date = $esiHelper->DecodeDate($journal['date']);
$check = DB::table('CorpJournals')->where('id', $journal['id'])->get();
//if we don't find the journal entry, add the journal entry to the database
if($check->count() === 0) {
@@ -126,7 +130,7 @@ class Finances {
if(isset($journal['context_id_type'])) {
$entry->context_id_type = $journal['context_id_type'];
}
$entry->date = $journal['date'];
$entry->date = $date;
$entry->description = $journal['description'];
if(isset($journal['first_party_id'])) {
$entry->first_party_id = $journal['first_party_id'];