Ejemplo n.º 1
0
 public function updateMarketInformation()
 {
     if (2097152 & $this->accessMask and 67108864 & $this->accessMask) {
         $pheal = new Pheal($this->keyID, $this->vCode, 'char');
         try {
             // Wallet Journal pull
             $response = $pheal->WalletJournal(array("characterID" => $this->characterID, "rowCount" => 2560));
             $stmtJournal = $this->db->prepare('INSERT INTO user_walletjournal (character_id,journal_id,journal_date,journal_type,journal_fromname,journal_fromid,journal_toname,journal_toid,journal_specialid,journal_specialname,journal_amount,journal_balance,journal_reason) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE journal_amount=VALUES(journal_amount)');
             foreach ($response->transactions as $transaction) {
                 $stmtJournal->execute(array($this->characterID, $transaction->refID, $transaction->date, $transaction->refTypeID, $transaction->ownerName1, $transaction->ownerID1, $transaction->ownerName2, $transaction->ownerID2, $transaction->argID1, $transaction->argName1, $transaction->amount, $transaction->balance, $transaction->reason));
             }
             // Contracts pull
             $response = $pheal->Contracts(array('characterID' => $this->characterID));
             $stmtContract = $this->db->prepare('INSERT INTO user_contracts (character_id,contract_id,contract_issuerid,contract_issuercorpid,contract_assigneeid,contract_acceptorid,contract_startstationid,' . 'contract_endstationid,contract_type,contract_status,contract_title,contract_forcorp,contract_availability,contract_dateissued,contract_dateexpired,contract_dateaccepted,' . 'contract_numdays,contract_datecompleted,contract_price,contract_reward,contract_collateral,contract_buyout,contract_volume) VALUES ' . '(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE contract_acceptorid=VALUES(contract_acceptorid),contract_status=VALUES(contract_status),' . 'contract_dateaccepted=VALUES(contract_dateaccepted),contract_dateexpired=VALUES(contract_dateexpired),contract_datecompleted=VALUES(contract_datecompleted)');
             foreach ($response->contractList as $contract) {
                 $stmtContract->execute(array($this->characterID, $contract->contractID, $contract->issuerID, $contract->issuerCorpID, $contract->assigneeID, $contract->acceptorID, $contract->startStationID, $contract->endStationID, $contract->type, $contract->status, $contract->title, $contract->forCorp, $contract->availability, $contract->dateIssued, $contract->dateExpired, $contract->dateAccepted, $contract->numDays, $contract->dateCompleted, $contract->price, $contract->reward, $contract->collateral, $contract->buyout, $contract->volume));
             }
             // Contact List pull
             $response = $pheal->ContactList(array("characterID" => $this->characterID));
             $stmtJournal = $this->db->prepare('INSERT INTO user_contactlist (character_id,contact_type,contact_id,contact_name,contact_inwatchlist,contact_standing) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE contact_inwatchlist=VALUES(contact_inwatchlist),contact_standing=VALUES(contact_standing)');
             foreach ($response->contactList as $contact) {
                 $stmtJournal->execute(array($this->characterID, 'personal', $contact->contactID, $contact->contactName, $contact->inWatchlist, $contact->standing));
             }
             return TRUE;
         } catch (\Pheal\Exceptions\PhealException $phealException) {
             // Putting the pheal exception through our test function to determine if it's a key failure, or an API server failure.
             $this->testAPIKeyStatus($phealException);
             return FALSE;
         }
     } else {
         return TRUE;
     }
 }