本文整理汇总了PHP中Stats::getTop方法的典型用法代码示例。如果您正苦于以下问题:PHP Stats::getTop方法的具体用法?PHP Stats::getTop怎么用?PHP Stats::getTop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stats
的用法示例。
在下文中一共展示了Stats::getTop方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calcTop
function calcTop($row)
{
global $mdb;
$timer = new Timer();
$currentSum = (int) @$row['shipsDestroyed'];
$parameters = [$row['type'] => $row['id']];
$parameters['limit'] = 10;
$parameters['kills'] = true;
$topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
$topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
$topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
$topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
$topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
$mdb->set('statistics', $row, ['topAllTime' => $topLists, 'allTimeSum' => $currentSum]);
if ($timer->stop() > 60000) {
exit;
}
}
示例2: calcTop
function calcTop($row)
{
global $mdb;
if (date('d') != '01' && isset($row['topAllTime'])) {
return;
}
$parameters = [$row['type'] => $row['id']];
$parameters['limit'] = 10;
$parameters['kills'] = true;
$topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
$topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
$topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
$topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
$topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
do {
$r = $mdb->set('statistics', $row, ['topAllTime' => $topLists]);
} while ($r['ok'] != 1);
}
示例3: calcTop
function calcTop($row)
{
global $mdb;
$allTimeSum = (int) @$row['allTimeSum'];
$currentSum = (int) @$row['shipsDestroyed'];
if ($allTimeSum == $currentSum) {
return;
}
$parameters = [$row['type'] => $row['id']];
$parameters['limit'] = 10;
$parameters['kills'] = true;
$topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters, true));
$topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters, true));
$topLists[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters, true));
$topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters, true));
$topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters, true));
do {
$r = $mdb->set('statistics', $row, ['topAllTime' => $topLists, 'allTimeSum' => $currentSum]);
} while ($r['ok'] != 1);
}
示例4: key
$columnName = key($p);
$id = (int) reset($p);
if (sizeof($p) <= 1) {
$app->redirect($fullAddr, 302);
}
$topPoints = array();
$topPods = array();
$p['kills'] = true;
$p['pastSeconds'] = $numDays * 86400;
$top = array();
$top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTop('characterID', $p));
$top[] = $columnName != 'corporationID' ? Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTop('corporationID', $p)) : array();
$top[] = $columnName != 'corporationID' && $columnName != 'allianceID' ? Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTop('allianceID', $p)) : array();
$top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTop('shipTypeID', $p));
$top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTop('solarSystemID', $p));
$top[] = Info::doMakeCommon('Top Locations', 'locationID', Stats::getTop('locationID', $p));
$requestUriPager = str_replace('ID', '', $columnName) . "/{$id}/";
$p['limit'] = 5;
$topIsk = Stats::getTopIsk($p);
unset($p['pastSeconds']);
unset($p['kills']);
// get latest kills
$killsLimit = 50;
$p['limit'] = $killsLimit;
$kills = Kills::getKills($p);
$kills = Kills::mergeKillArrays($kills, array(), $killsLimit, $columnName, $id);
Info::addInfo($p);
$pageTitle = array();
foreach ($p as $key => $value) {
if (strpos($key, 'Name') !== false) {
$pageTitle[] = $value;
示例5: array
case 'faction':
$filter = "{$key}ID = :id";
}
if ($filter != '') {
$query = ["{$key}ID" => (int) $id, 'isVictim' => false, 'groupID' => [659, 30], 'pastSeconds' => 90 * 86400];
$query = MongoFilter::buildQuery($query);
$hasSupers = $mdb->exists('killmails', $query);
$extra['hasSupers'] = $hasSupers;
$extra['supers'] = array();
if ($pageType == 'supers' && $hasSupers) {
$data = array();
$parameters = ["{$key}ID" => (int) $id, 'groupID' => 30, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['titans']['data'] = Stats::getTop('characterID', $parameters);
$data['titans']['title'] = 'Titans';
$parameters = ["{$key}ID" => (int) $id, 'groupID' => 659, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['moms']['data'] = Stats::getTop('characterID', $parameters);
$data['moms']['title'] = 'Supercarriers';
Info::addInfo($data);
$extra['supers'] = $data;
$extra['hasSupers'] = sizeof($data['titans']['data']) || sizeof($data['moms']['data']);
}
}
if ($key == 'system') {
$statType = 'solarSystemID';
} elseif ($key == 'ship') {
$statType = 'shipTypeID';
} else {
$statType = "{$key}ID";
}
$statistics = $mdb->findDoc('statistics', ['type' => $statType, 'id' => (int) $id]);
$prevRanks = $mdb->findDoc('ranksProgress', ['cacheTime' => 36000, 'type' => $statType, 'id' => (int) $id], ['date' => 1]);
示例6: array
<?php
$parameters = array('limit' => 10, 'kills' => true, 'pastSeconds' => 3600, 'cacheTime' => 30);
$alltime = false;
$topKillers[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topKillers[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
$topKillers[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters));
$topKillers[] = array('type' => 'faction', 'data' => Stats::getTop('factionID', $parameters));
$topKillers[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters));
$topKillers[] = array('type' => 'region', 'data' => Stats::getTop('regionID', $parameters));
$topKillers[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters));
$topKillers[] = array('type' => 'group', 'data' => Stats::getTop('groupID', $parameters));
unset($parameters['kills']);
$parameters['losses'] = true;
$topLosers[] = array('type' => 'character', 'ranked' => 'Losses', 'data' => Stats::getTop('characterID', $parameters));
$topLosers[] = array('type' => 'corporation', 'ranked' => 'Losses', 'data' => Stats::getTop('corporationID', $parameters));
$topLosers[] = array('type' => 'alliance', 'ranked' => 'Losses', 'data' => Stats::getTop('allianceID', $parameters));
$topLosers[] = array('type' => 'faction', 'ranked' => 'Losses', 'data' => Stats::getTop('factionID', $parameters));
$topLosers[] = array('type' => 'ship', 'ranked' => 'Losses', 'data' => Stats::getTop('shipTypeID', $parameters));
$topLosers[] = array('type' => 'group', 'ranked' => 'Losses', 'data' => Stats::getTop('groupID', $parameters));
$app->render('lasthour.html', array('topKillers' => $topKillers, 'topLosers' => $topLosers, 'time' => date('H:i')));
示例7: key
$p['page'] = $page;
$columnName = key($p);
$id = (int) reset($p);
if (sizeof($p) <= 1) {
$app->redirect($fullAddr, 302);
}
$topPoints = array();
$topPods = array();
$p['kills'] = true;
$p['pastSeconds'] = $numDays * 86400;
$top = array();
$top[] = Info::doMakeCommon('Top Characters', 'characterID', Stats::getTop('characterID', $p));
$top[] = $columnName != 'corporationID' ? Info::doMakeCommon('Top Corporations', 'corporationID', Stats::getTop('corporationID', $p)) : array();
$top[] = $columnName != 'corporationID' && $columnName != 'allianceID' ? Info::doMakeCommon('Top Alliances', 'allianceID', Stats::getTop('allianceID', $p)) : array();
$top[] = Info::doMakeCommon('Top Ships', 'shipTypeID', Stats::getTop('shipTypeID', $p));
$top[] = Info::doMakeCommon('Top Systems', 'solarSystemID', Stats::getTop('solarSystemID', $p));
$requestUriPager = str_replace('ID', '', $columnName) . "/{$id}/";
$p['limit'] = 5;
$topIsk = Stats::getTopIsk($p);
unset($p['pastSeconds']);
unset($p['kills']);
// get latest kills
$killsLimit = 50;
$p['limit'] = $killsLimit;
$kills = Kills::getKills($p);
$kills = Kills::mergeKillArrays($kills, array(), $killsLimit, $columnName, $id);
Info::addInfo($p);
$pageTitle = array();
foreach ($p as $key => $value) {
if (strpos($key, 'Name') !== false) {
$pageTitle[] = $value;
示例8: getStats
function getStats($column)
{
$result = Stats::getTop($column, ['isVictim' => false, 'pastSeconds' => 604800]);
return $result;
}
示例9: getSupers
public static function getSupers($key, $id)
{
$data = array();
$parameters = [$key => (int) $id, 'groupID' => 30, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['titans']['data'] = Stats::getTop('characterID', $parameters);
$data['titans']['title'] = 'Titans';
$parameters = [$key => (int) $id, 'groupID' => 659, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['supercarriers']['data'] = Stats::getTop('characterID', $parameters);
$data['supercarriers']['title'] = 'Supercarriers';
Info::addInfo($data);
return $data;
}
示例10: array
$alltime = false;
$parameters = array();
// $time is an array
if (!isset($time)) {
$parameters = array('limit' => 10, 'kills' => true);
}
switch ($page) {
case 'monthly':
$parameters['year'] = date('Y');
$parameters['month'] = date('n');
break;
case 'weekly':
$parameters['year'] = date('Y');
$parameters['week'] = date('W');
break;
default:
die('Not supported yet.');
}
$topLists = array();
if ($type == 'kills') {
$topLists[] = array('type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topLists[] = array('type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
$topLists[] = array('type' => 'alliance', 'data' => Stats::getTop('allianceID', $parameters));
$topLists[] = array('type' => 'ship', 'data' => Stats::getTop('shipTypeID', $parameters));
$topLists[] = array('type' => 'system', 'data' => Stats::getTop('solarSystemID', $parameters));
$parameters['!factionID'] = 0;
$topLists[] = array('name' => 'Top Faction Characters', 'type' => 'character', 'data' => Stats::getTop('characterID', $parameters));
$topLists[] = array('name' => 'Top Faction Corporations', 'type' => 'corporation', 'data' => Stats::getTop('corporationID', $parameters));
}
$app->render('top.html', array('topLists' => $topLists, 'page' => $page, 'type' => $type));