本文整理汇总了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;
}