本文整理汇总了PHP中Stats类的典型用法代码示例。如果您正苦于以下问题:PHP Stats类的具体用法?PHP Stats怎么用?PHP Stats使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Stats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
/**
* process a request
*
* @param $params
*/
function processRequest($params)
{
// create new instance
$instanceStats = new Stats($params);
// call instance-method
$instanceStats->instance_processRequest();
}
示例2: FindNewGenerations
function FindNewGenerations($bitcoinController)
{
$blockcount = 0;
$username = '';
//Get list of last 200 transactions
$transactions = $bitcoinController->query("listtransactions", "*", "200");
//Go through all the transactions check if there is 50BTC inside
$numAccounts = count($transactions);
for ($i = 0; $i < $numAccounts; $i++) {
//Check for 50BTC inside only if they are in the generate category
if ($transactions[$i]["category"] == "generate" || $transactions[$i]["category"] == "immature") {
//At this point we may or may not have found a block,
//Check to see if this account addres is already added to `networkBlocks`
$accountExistsQ = mysql_query("SELECT id FROM networkBlocks WHERE accountAddress = '" . $transactions[$i]["txid"] . "' ORDER BY blockNumber DESC LIMIT 0,1") or sqlerr(__FILE__, __LINE__);
$accountExists = mysql_num_rows($accountExistsQ);
//Insert txid into latest network block
if (!$accountExists) {
//Get last winning block
$lastSuccessfullBlockQ = mysql_query("SELECT blockNumber, id, username FROM winning_shares ORDER BY id DESC LIMIT 1") or sqlerr(__FILE__, __LINE__);
$lastSuccessfullBlockR = mysql_fetch_object($lastSuccessfullBlockQ);
$timestamp = $transactions[$i]["time"];
$id = $lastSuccessfullBlockR->id;
$rpcType = "http";
// http or https
$rpcUsername = "thisisusername";
// username
$rpcPassword = "thisissparta";
// password
$rpcHost = "localhost";
$rpcPort = 9000;
$bitcoinController = new BitcoinClient($rpcType, $rpcUsername, $rpcPassword, $rpcHost, $rpcPort);
$currentBlockNumber = $bitcoinController->getblocknumber();
$confirms = $transactions[$i]["confirmations"];
$lastBlockNumber = $currentBlockNumber + 1 - $confirms;
$stats = new Stats();
mysql_query("INSERT INTO networkBlocks (blockNumber, timestamp, accountAddress, confirms) " . "VALUES ('{$lastBlockNumber}', '{$timestamp}', '" . $transactions[$i]["txid"] . "', '" . $transactions[$i]["confirmations"] . "')") or sqlerr(__FILE__, __LINE__);
$stats = new Stats();
$lastwinningid = $stats->lastWinningShareId();
$shareQ = mysql_query("SELECT sum(shares) as total from rounddetails WHERE blockNumber = {$lastBlockNumber}");
$shareC = mysql_fetch_object($shareQ);
$winningShareQ = mysql_query("SELECT id, username FROM shares where upstream_result = 'Y' AND id > {$lastwinningid}") or sqlerr(__FILE__, __LINE__);
while ($winningShareR = mysql_fetch_object($winningShareQ)) {
mysql_query("INSERT INTO winning_shares (blockNumber, username, share_id) VALUES ({$lastBlockNumber},'{$winningShareR->username}',{$winningShareR->id})") or sqlerr(__FILE__, __LINE__);
removeCache("last_winning_share_id");
}
// $q = "UPDATE winning_shares SET amount = " . $transactions[$i]["amount"] . ", timestamp = " . $timestamp . ", txid = '".$transactions[$i]["txid"] . "', type = '" . $transactions[$i]["category"] . "', shares = ". $shareC->total . " WHERE blockNumber = $lastBlockNumber";
$q = "UPDATE winning_shares SET amount = " . $transactions[$i]["amount"] . ", timestamp = " . $timestamp . ", txid = '" . $transactions[$i]["txid"] . "', type = '" . $transactions[$i]["category"] . "' WHERE blockNumber = {$lastBlockNumber}";
echo $q;
mysql_query($q) or sqlerr(__FILE__, __LINE__);
$username = $lastSuccessfullBlockR->username;
$splitUsername = explode(".", $username);
$realUsername = $splitUsername[0];
$blockcount = $blockcount + 1;
$username .= $realUsername . ' ';
}
}
}
}
示例3: getStats
public static function getStats($campaign)
{
$params = array('id' => $campaign);
# Call
$response = static::$mj->messageStatistics($params);
# Result
$res = (array) $response->result;
$stats = new Stats();
return $stats->populate($res);
}
示例4: show
public static function show($id)
{
$pokemon = Pokemons::find($id);
//$joins = Joins::getJoins($id);
$stats = Stats::getStats($id);
View::make('Pokemons/:id.html', array('pokemon' => $pokemon, 'stats' => $stats));
}
示例5: getStats
public function getStats()
{
if (is_null(self::$me)) {
self::$me = new Stats();
}
return self::$me;
}
示例6: index
public function index()
{
$stats = new Stats();
$stats->addStatSubject('ViralList', 'List');
$todayStats = $stats->getTodayStats();
$overallStats = $stats->getOverallStats();
View::share(array('overallStats' => $overallStats, 'todayStats' => $todayStats));
/*
$last30DaysNewItems = Stats::getDailyStatsFor('ItemModelName', 30);
View::share(array('last30DaysNewItems' => json_encode($last30DaysNewItems)));
*/
$last30DaysUserRegistrations = Stats::getDailyStatsFor('User', 30);
$last30DaysNewLists = Stats::getDailyStatsFor('ViralList', 30);
View::share(array('last30DaysUserRegistrations' => json_encode($last30DaysUserRegistrations), 'last30DaysNewLists' => json_encode($last30DaysNewLists)));
return View::make('admin/index');
}
示例7: procede
public function procede()
{
$aStats = Stats::getGlobalStats();
$this->oView->addData('textItems', $aStats);
$this->oView->addData('trackers', Tracker::getTrackersSelect());
$this->oView->Create();
}
示例8: testRanked
public function testRanked()
{
$this->client->shouldReceive('baseUrl')->once();
$this->client->shouldReceive('request')->with('na/v1.3/stats/by-summoner/74602/ranked', ['api_key' => 'key'])->once()->andReturn(file_get_contents('tests/Json/stats.ranked.74602.season4.json'));
Api::setKey('key', $this->client);
$stats = Stats::ranked(74602);
$this->assertTrue($stats->champion(0) instanceof LeagueWrap\Dto\ChampionStats);
}
示例9: getStats
/**
* Get the query builder object for the Stats model's table prepared with the requested items,
* ordered by one of the stats column.
*
* @param $days String one_day_stats|seven_days_stats|thirty_days_stats|all_time_stats
* @param $orderType String ASC|DESC
* @param $modelType String Filter by this Eloquent Model type
* @param $limit int Number of items to return
* @return \Illuminate\Database\Eloquent\Builder
*/
public function getStats($days = 'one_day_stats', $orderType = 'DESC', $modelType = '', $limit = null)
{
$stats = new Stats();
$query = $stats->newQuery();
if (!empty($modelType)) {
$query->where('trackable_type', '=', $modelType);
}
// Only retrieve elements with at least 1 hit in the requested period
if (!empty($days)) {
$query->where($days, '!=', 0);
}
if (!empty($limit)) {
$query->take($limit);
}
$query->orderBy($days, $orderType);
return $query;
}
示例10: smarty_function_mtstatssnippet
function smarty_function_mtstatssnippet($args, &$ctx)
{
$provider = Stats::readied_provider($ctx->stash('blog'));
if (empty($provider)) {
return '';
}
return $provider->snippet($args, $ctx);
}
示例11: query
/**
* executes query
*
* @param string $sql
* @return result
*/
public function query($sql)
{
$sqlDebug = defined("DEBUG") && DEBUG && isset($_REQUEST["sql_debug"]);
$sql = $sql;
if ($sqlDebug) {
$stats = new Stats();
}
$this->querycount++;
$res = mysql_query($sql, $this->connection) or $this->error(mysql_error(), $sql);
if ($sqlDebug) {
$stats->storeDifference();
echo "\n<!--\n";
echo "Query #{$this->querycount}: {$sql}\n";
echo "Memory used: {$stats->memUsedFmted} bytes\n";
echo "Time spent: {$stats->timeSpent} seconds\n";
echo "-->\n";
}
return $res;
}
示例12: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
try {
$log = new Process();
$log->name = "get-shares";
$log->status = "running";
$log->save();
$filterDate = new DateTime('now');
$filterDate->sub(new DateInterval('P1D'));
//Load shares
Link::where('date', '>', $filterDate)->chunk(100, function ($links) {
foreach ($links as $value) {
$shares = $this->getSharesCount($value->final_url);
$ref = Stats::where('id_link', $value->id)->orderBy('created_at', 'DESC')->first();
if (!$ref) {
$ref = new stdClass();
$ref->total = 0;
}
$stat = new Stats();
$stat->id_link = $value->id;
$stat->facebook = $shares['facebook'] != null ? $shares['facebook'] : $value->facebook;
$stat->twitter = $shares['twitter'] != null ? $shares['twitter'] : $value->twitter;
$stat->linkedin = $shares['linkedin'] != null ? $shares['linkedin'] : $value->linkedin;
$stat->googleplus = $shares['googleplus'] != null ? $shares['googleplus'] : $value->googleplus;
$stat->total = $stat->facebook + $stat->twitter + $stat->linkedin + $stat->googleplus;
$stat->dif_total = $stat->total - $ref->total;
$stat->save();
$value->facebook = $stat->facebook;
$value->twitter = $stat->twitter;
$value->linkedin = $stat->linkedin;
$value->googleplus = $stat->googleplus;
$value->total = $stat->total;
$value->save();
}
});
$log->status = "finished";
$log->save();
} catch (Exception $e) {
$this->info($url);
$this->info($e->getMessage());
}
}
示例13: visit
function visit($countRobotVisit = 'y') {
global $database, $db;
if ($countRobotVisit == 'n' && Stats::isKnownBot($_SERVER["HTTP_USER_AGENT"])) return;
$now = time();
$db->query('SELECT date FROM '.$database['prefix'].'DailyStatistics WHERE date="'.date('Ymd', $now).'"');
if ($db->numRows() < 1) {
$db->execute('INSERT INTO '.$database['prefix'].'DailyStatistics (date) VALUES ("'.date('Ymd', $now).'")');
}
$db->free();
$db->execute('UPDATE '.$database['prefix'].'DailyStatistics SET visits=visits+1 WHERE date="'.date('Ymd', $now).'"');
$db->execute('UPDATE '.$database['prefix'].'Settings SET value=value+1 WHERE name = "totalVisit"');
}
示例14: getSparklinesData
public function getSparklinesData($ids)
{
$ids = explode(',', $ids);
if (count($ids) > 10) {
$ids = array_slice($ids, 0, 10);
}
$response = array();
foreach ($ids as $key => $id) {
$response[$id]['total'] = Stats::where('id_link', $id)->lists('total');
$response[$id]['dif_total'] = Stats::where('id_link', $id)->lists('dif_total');
}
return Response::json(array('data' => $response));
}
示例15: doSupers
function doSupers($row)
{
global $mdb;
$type = $row['type'];
$id = (int) $row['id'];
$query = [$type => (int) $id, 'isVictim' => false, 'groupID' => [659, 30], 'pastSeconds' => 90 * 86400];
$query = MongoFilter::buildQuery($query);
$hasSupers = $mdb->exists('killmails', $query);
if ($hasSupers == false) {
$mdb->set("statistics", ['type' => $type, 'id' => $id], ['hasSupers' => false, 'supers' => []]);
} else {
$supers = Stats::getSupers($type, $id);
$mdb->set("statistics", ['type' => $type, 'id' => $id], ['hasSupers' => true, 'supers' => $supers]);
}
}