本文整理汇总了PHP中tools::isPeakNow方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::isPeakNow方法的具体用法?PHP tools::isPeakNow怎么用?PHP tools::isPeakNow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::isPeakNow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
<?php
define('_DIR_', dirname(__FILE__));
require_once 'config/db.php';
require_once 'config/settings.inc.php';
require_once 'app/core/tools.class.php';
require_once 'app/core/database.class.php';
require_once 'daemons_functions.php';
date_default_timezone_set($settings['app']['timezone']);
session_start();
if (!empty($_SESSION['user_id'])) {
$data['user_id'] = $_SESSION['user_id'];
} else {
$data['user_id'] = null;
}
if (!empty($_GET['id'])) {
$data['auction_id'] = htmlspecialchars($_GET['id'], ENT_QUOTES, 'UTF-8');
$data['time_increment'] = get('time_increment', $data['auction_id'], 0);
$data['bid_debit'] = get('bid_debit', $data['auction_id'], 0);
$data['price_increment'] = get('price_increment', $data['auction_id'], 0);
}
$data['isPeakNow'] = tools::isPeakNow();
// bid the auction
$auction = bid($data);
示例2: define
<?php
define('_DIR_', dirname(__FILE__));
require_once _DIR_ . '/config/settings.inc.php';
require_once _DIR_ . '/config/db.php';
require_once _DIR_ . '/app/core/database.class.php';
require_once _DIR_ . '/app/core/tools.class.php';
require_once _DIR_ . '/app/libs/fastjson/fastjson.php';
session_start();
if (!empty($_SESSION['user_id'])) {
$user_id = $_SESSION['user_id'];
} else {
$user_id = null;
}
date_default_timezone_set($settings['app']['timezone']);
$isPeakNow = tools::isPeakNow();
$site_online = tools::siteOnline();
$data = $_POST;
if (empty($data)) {
die('No data given');
}
$results = array();
foreach ($data as $key => $value) {
if (!empty($_GET['histories'])) {
$result = tools::readCache('auction_view_' . $value);
} else {
$result = tools::readCache('auction_' . $value);
}
if (empty($result)) {
$db = database::getInstance();
// gettting data
示例3: microtime
if (tools::readCache('close.pid')) {
return false;
} else {
tools::writeCache('close.pid', microtime(), 50);
}
$db = database::getInstance();
$isPeakNow = tools::isPeakNow();
$expireTime = time() + 60;
while (time() < $expireTime) {
$sql = "SELECT id, peak_only, end_time FROM " . DB_PREFIX . "auctions WHERE end_time <= '" . date('Y-m-d H:i:s') . "' AND closed=0 AND active=1 AND status_id=3";
if ($res = $db->getRows($sql)) {
if (sizeof($res) > 0) {
foreach ($res as $auction) {
if (checkCanClose($auction['id'], $isPeakNow) == false) {
if ($auction['peak_only'] == 1 && !$isPeakNow) {
$peak = tools::isPeakNow(true);
if (strtotime($peak['peak_start']) < time()) {
$peak['peak_start'] = date('Y-m-d H:i:s', strtotime($peak['peak_start']) + 86400);
}
$seconds_after_peak = strtotime($auction['end_time']) - strtotime($peak['peak_end']);
$time = strtotime($peak['peak_start']) + $seconds_after_peak;
$endTime = date('Y-m-d H:i:s', $time);
if (strtotime($endTime) < time()) {
$endTime = date('Y-m-d H:i:s', strtotime($endTime) + 86400);
}
$db->update('auctions', "end_time = '{$endTime}'", "id = {$auction['id']}");
} else {
$data['auction_peak_start'] = get('auction_peak_start');
$data['auction_peak_end'] = get('auction_peak_end');
$data['isPeakNow'] = $isPeakNow;
$data['time_increment'] = get('time_increment', $auction['id'], 0);