本文整理汇总了PHP中Price::getItemPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Price::getItemPrice方法的具体用法?PHP Price::getItemPrice怎么用?PHP Price::getItemPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Price
的用法示例。
在下文中一共展示了Price::getItemPrice方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usdeurgbp
public static function usdeurgbp($totalprice)
{
$usd = 17;
$eur = 13;
$gbp = 10;
$plex = Price::getItemPrice('29668', date('Ymd'));
$usdval = $plex / $usd;
$eurval = $plex / $eur;
$gbpval = $plex / $gbp;
return array('usd' => $totalprice / $usdval, 'eur' => $totalprice / $eurval, 'gbp' => $totalprice / $gbpval);
}
示例2: beSocial
function beSocial($killID)
{
global $beSocial, $mdb;
if (!isset($beSocial)) {
$beSocial = false;
}
if ($beSocial === false) {
return;
}
if ($killID < 0) {
return;
}
$ircMin = 10000000000.0;
$twitMin = 10000000000.0;
$kill = $mdb->findDoc('killmails', ['killID' => $killID]);
if (@$kill['social'] == true) {
return;
}
$hours24 = time() - 86400;
if ($kill['dttm']->sec < $hours24) {
return;
}
// Get victim info
$victimInfo = $kill['involved'][0];
if ($victimInfo == null) {
return;
}
$totalPrice = $kill['zkb']['totalValue'];
Info::addInfo($victimInfo);
// Reduce spam of freighters and jump freighters
$shipGroupID = $victimInfo['groupID'];
if (in_array($shipGroupID, array(513, 902))) {
$shipPrice = Price::getItemPrice($victimInfo['shipTypeID'], date('Ymd'));
$ircMin += $shipPrice;
$twitMin += $shipPrice;
}
$worthIt = false;
$worthIt |= $totalPrice >= $ircMin;
if (!$worthIt) {
return;
}
$tweetIt = false;
$tweetIt |= $totalPrice >= $twitMin;
global $fullAddr, $twitterName;
$url = "{$fullAddr}/kill/{$killID}/";
if ($url == '') {
$url = "{$fullAddr}/kill/{$killID}/";
}
$message = '|g|' . $victimInfo['shipName'] . '|n| worth |r|' . Util::formatIsk($totalPrice) . " ISK|n| was destroyed! {$url}";
if (!isset($victimInfo['characterName'])) {
$victimInfo['characterName'] = $victimInfo['corporationName'];
}
if (strlen($victimInfo['characterName']) < 25) {
$name = $victimInfo['characterName'];
if (Util::endsWith($name, 's')) {
$name .= "'";
} else {
$name .= "'s";
}
$message = "{$name} {$message}";
}
$mdb->getCollection('killmails')->update(['killID' => $killID], ['$unset' => ['social' => true]]);
Log::irc("{$message}");
$message = Log::stripIRCColors($message);
$message .= ' #tweetfleet #eveonline';
if (strlen($message) > 120) {
$message = str_replace(' worth ', ': ', $message);
}
if (strlen($message) > 120) {
$message = str_replace(' was destroyed!', '', $message);
}
if ($tweetIt && strlen($message) <= 120) {
$return = Twit::sendMessage($message);
$twit = "https://twitter.com/{$twitterName}/status/" . $return->id;
Log::irc("Message was also tweeted: |g|{$twit}");
}
}
示例3: addItems
public static function addItems(&$itemArray, $items, $killTime, $inContainer = 0, $parentFlag = 0)
{
if ($items == null) {
return;
}
if (is_array($items)) {
foreach ($items as $item) {
$typeID = $item['itemType']['id'];
$item['typeID'] = $typeID;
$item['price'] = Price::getItemPrice($typeID, $killTime);
$item['inContainer'] = $inContainer;
if ($inContainer) {
$item['flag'] = $parentFlag;
}
if ($inContainer && strpos(Info::getInfoField('typeID', $typeID, 'name'), 'Blueprint')) {
$item['singleton'] = 2;
}
unset($item['_stringValue']);
$itemArray[] = $item;
$subItems = isset($item['items']) ? $item['items'] : null;
unset($item['items']);
if ($subItems != null) {
self::addItems($itemArray, $subItems, $killTime, 1, $item['flag']);
}
}
}
}
示例4: header
global $mdb;
if (!is_numeric($id)) {
$id = Info::getItemId($id);
if ($id > 0) {
header("Location: /item/{$id}/");
} else {
header('Location: /');
}
die;
}
$info = $mdb->findDoc("information", ['type' => 'typeID', 'id' => (int) $id, 'cacheTime' => 3600]);
$info['typeName'] = $info['name'];
$info['description'] = str_replace('<br>', "\n", @$info['description']);
$info['description'] = strip_tags(@$info['description']);
$info['price'] = Price::getItemPrice($id, date('Ymd'));
global $mdb;
$cursor = $mdb->getCollection('killmails')->find(['involved.shipTypeID' => (int) $id]);
$hasKills = $cursor->hasNext();
$info['attributes'] = array();
$info['market'] = Db::query('select * from zz_item_price_lookup where typeID = :typeID order by priceDate desc limit 30', array(':typeID' => $id));
$kills = $mdb->find('itemmails', ['typeID' => (int) $id], ['killID' => -1], 50);
$victims = [];
foreach ($kills as $row) {
$kill = $mdb->findDoc('killmails', ['killID' => $row['killID']]);
$victim = $kill['involved'][0];
$victim['destroyed'] = $row['killID'];
$victims[] = $victim;
}
Info::addInfo($victims);
$app->render('item.html', array('info' => $info, 'hasKills' => $hasKills, 'kills' => $victims));
示例5: processItem
function processItem($item, $dttm, $isCargo = false, $parentContainerFlag = -1)
{
global $mdb;
$typeID = $item['itemType']['id'];
$itemName = $mdb->findField("information", 'name', ['type' => 'typeID', 'id' => (int) $typeID]);
if ($itemName == null) {
$itemName = "TypeID {$typeID}";
}
if ($typeID == 33329 && $item['flag'] == 89) {
$price = 0.01;
} else {
$price = Price::getItemPrice($typeID, $dttm, true);
}
if ($isCargo && strpos($itemName, 'Blueprint') !== false) {
$item['singleton'] = 2;
}
if ($item['singleton'] == 2) {
$price = $price / 100;
}
return $price * (@$item['quantityDropped'] + @$item['quantityDestroyed']);
}
示例6: processItem
function processItem($item, $dttm, $isCargo = false, $parentContainerFlag = -1)
{
$typeID = $item['itemType']['id'];
$itemName = Db::queryField('select typeName from ccp_invTypes where typeID = :typeID', 'typeName', array(':typeID' => $typeID), 0);
if ($itemName == null) {
$itemName = "TypeID {$typeID}";
}
if ($typeID == 33329 && $item['flag'] == 89) {
$price = 0.01;
} else {
$price = Price::getItemPrice($typeID, $dttm, true);
}
if ($isCargo && strpos($itemName, 'Blueprint') !== false) {
$item['singleton'] = 2;
}
if ($item['singleton'] == 2) {
$price = $price / 100;
}
return $price * (@$item['quantityDropped'] + @$item['quantityDestroyed']);
}
示例7: processItem
/**
* @param integer $itemInsertOrder
*/
private static function processItem(&$kill, &$killID, &$item, $itemInsertOrder, $isCargo = false, $parentContainerFlag = -1)
{
global $itemNames;
if ($itemNames == null) {
$itemNames = array();
$results = Db::query("select typeID, typeName from ccp_invTypes", array(), 3600);
foreach ($results as $row) {
$itemNames[$row["typeID"]] = $row["typeName"];
}
}
$typeID = $item["typeID"];
if (isset($item["typeID"]) && isset($itemNames[$item["typeID"]])) {
$itemName = $itemNames[$item["typeID"]];
} else {
$itemName = "TypeID {$typeID}";
}
if ($item["typeID"] == 33329 && $item["flag"] == 89) {
$price = 0.01;
} else {
$price = Price::getItemPrice($typeID);
}
if ($isCargo && strpos($itemName, "Blueprint") !== false) {
$item["singleton"] = 2;
}
if ($item["singleton"] == 2) {
$price = $price / 100;
}
Db::execute("insert ignore into zz_item_price_lookup (typeID, priceDate, price) values (:typeID, now(), :price)", array(":typeID" => $item["typeID"], ":price" => $price));
return $price * ($item["qtyDropped"] + $item["qtyDestroyed"]);
}
示例8: date
<?php
require_once "../init.php";
$date = date('Ymd', time() - 7200);
$yesterday = date('Y-m-d', time() - 7200 - 86400);
$key = "tq:pricesChecked:{$date}";
if ($redis->get($key) == true) {
exit;
}
$crestPrices = CrestTools::getJson("https://public-crest.eveonline.com/market/prices/");
if (!isset($crestPrices['items'])) {
exit;
}
foreach ($crestPrices['items'] as $item) {
$typeID = $item['type']['id'];
$price = Price::getItemPrice($typeID, $date, true);
$marketHistory = $mdb->findDoc("prices", ['typeID' => $typeID]);
if ($marketHistory === null) {
$marketHistory = ['typeID' => $typeID];
$mdb->save("prices", $marketHistory);
}
if (!isset($marketHistory[$yesterday]) && isset($item['averagePrice'])) {
$avgPrice = $item['averagePrice'];
$mdb->set("prices", ['typeID' => $typeID], [$yesterday => $avgPrice]);
}
}
$redis->set($key, true);
示例9: usdeurgbp
function usdeurgbp($totalprice)
{
$usd = 17;
$eur = 13;
$gbp = 10;
$plex = Price::getItemPrice("29668");
$usdval = $plex / $usd;
$eurval = $plex / $eur;
$gbpval = $plex / $gbp;
return array("usd" => $totalprice / $usdval, "eur" => $totalprice / $eurval, "gbp" => $totalprice / $gbpval);
}