示例#1
0
 public function updateAssets()
 {
     $pheal = new Pheal($this->_keyID, $this->_vCode, 'char');
     try {
         $phealAssets = $pheal->AssetList(array('characterID' => $this->_characterID));
         $stmt = $this->_db->prepare('DELETE FROM user_assets WHERE uid = ? AND characterID = ?');
         $stmt->execute(array($this->_userID, $this->_characterID));
         foreach ($phealAssets->assets as $asset) {
             if ($asset['singleton'] == 0) {
                 $packaged = 1;
             } else {
                 $packaged = 0;
             }
             $stmt = $this->_db->prepare('INSERT INTO user_assets (uid,characterID,itemID,typeID,locationID,quantity,flag,packaged,parent_item) VALUES (?,?,?,?,?,?,?,?,?) ' . 'ON DUPLICATE KEY UPDATE quantity=VALUES(quantity)');
             $stmt->execute(array($this->_userID, $this->_characterID, $asset['itemID'], $asset['typeID'], $asset['locationID'], $asset['quantity'], $asset['flag'], $packaged, null));
             if ($packaged == 0) {
                 if (isset($asset->contents)) {
                     foreach ($asset->contents as $item) {
                         if ($item['singleton'] == 0) {
                             $packaged = 1;
                         } else {
                             $packaged = 0;
                         }
                         $stmt = $this->_db->prepare('INSERT INTO user_assets (uid,characterID,itemID,typeID,quantity,flag,packaged,parent_item) VALUES (?,?,?,?,?,?,?,?) ' . 'ON DUPLICATE KEY UPDATE quantity=VALUES(quantity)');
                         $stmt->execute(array($this->_userID, $this->_characterID, $item['itemID'], $item['typeID'], $item['quantity'], $item['flag'], $packaged, $asset['itemID']));
                     }
                 }
             }
         }
         return true;
     } catch (\Pheal\Exceptions\PhealException $phealException) {
     }
 }
示例#2
0
                 $repeated++;
             }
         }
     }
     $newOrdersVal = count($newOrders) - $repeated;
 } else {
     $newOrdersVal = 0;
     $update_orders = False;
 }
 $sellOrderValueTotal = utils::mysqli_result(mysqli_query($con, "SELECT sum(orders.volume_remaining * item_price_data.price_evecentral) AS grand_total \n                    FROM orders \n                    JOIN item_price_data ON item_price_data.item_eve_iditem = orders.eve_item_iditem\n                    WHERE characters_eve_idcharacters = '{$idcharacter}' AND orders.order_state = 'open' AND orders.type = 'sell'"), 0, 0);
 ////////////////////////////////
 //Update assets info
 /////////////////////////////////
 $pheal_assets = new Pheal($apikey, $vcode, "char");
 //set scope
 $response_assets = $pheal->AssetList(array("characterID" => $idcharacter));
 //add parameters
 $assetList = array();
 $i = 0;
 //for iterating each asset
 $index_asset = 0;
 //for iterating the final array with all assets
 (int) ($networth = 0);
 foreach ($response_assets->assets as $assets) {
     $typeID_asset = $assets['typeID'];
     $locationID = $assets['locationID'];
     $quantity_asset = $assets['quantity'];
     $i++;
     // array_push($assetIDList, $typeID_asset);
     //  array_push($assetQList, $quantity_asset);
     $assetList[$i] = array("NULL", $idcharacter, $typeID_asset, $quantity_asset, $locationID);