本文整理匯總了PHP中Referrer::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP Referrer::update方法的具體用法?PHP Referrer::update怎麽用?PHP Referrer::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Referrer
的用法示例。
在下文中一共展示了Referrer::update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: refreshCache
public static function refreshCache($referrers = null, $employee = null)
{
if (!$referrers or !is_array($referrers)) {
$referrers = Db::getInstance()->ExecuteS('SELECT id_referrer FROM ' . _DB_PREFIX_ . 'referrer');
}
foreach ($referrers as $row) {
$referrer = new Referrer((int) $row['id_referrer']);
$statsVisits = $referrer->getStatsVisits(null, $employee);
$referrer->cache_visitors = $statsVisits['uniqs'];
$referrer->cache_visits = $statsVisits['visits'];
$referrer->cache_pages = $statsVisits['pages'];
$registrations = $referrer->getRegistrations(null, $employee);
$referrer->cache_registrations = (int) $registrations;
$statsSales = $referrer->getStatsSales(null, $employee);
$referrer->cache_orders = (int) $statsSales['orders'];
$referrer->cache_sales = number_format($statsSales['sales'], 2, '.', '');
$referrer->cache_reg_rate = $statsVisits['uniqs'] ? (int) $registrations / $statsVisits['uniqs'] : 0;
$referrer->cache_order_rate = $statsVisits['uniqs'] ? (int) $statsSales['orders'] / $statsVisits['uniqs'] : 0;
if (!$referrer->update()) {
Tools::dieObject(mysql_error());
}
Configuration::updateValue('PS_REFERRERS_CACHE_LIKE', ModuleGraph::getDateBetween($employee));
Configuration::updateValue('PS_REFERRERS_CACHE_DATE', date('Y-m-d H:i:s'));
}
return true;
}