www.gusucode.com > citySHOP B2C商城系统 进销存 2.0.6码程序 > upload/include/crons/index_topic.inc.php
<?php if (!defined('IN_APP')) { exit('Access Denied'); } include_once(APP_ROOT.'./include/cache.func.php'); $toparr = array(); /** * 商品排行榜 */ //点击排行 $toparr['viewtops'] = array(); $topnum = 0; $query = $db->query("SELECT gid,subject,eprice,discount,photos FROM {$tablepre}goods ORDER BY views DESC LIMIT 0,8"); while($arr = $db->fetch_array($query)){ $topnum++; $arr['top'] = $topnum; $arr['photo'] = array_shift(unserialize($arr['photos'])); $arr['zprice'] = number_format($arr['eprice'] * ($arr['discount'] / 10), 2,'.',''); $toparr['viewtops'][] = $arr; } //收藏排行 $toparr['favortops'] = array(); $topnum = 0; $query = $db->query("SELECT g.gid,g.subject,g.eprice,g.discount,g.photos,COUNT(f.gid) as topic FROM {$tablepre}goods g,{$tablepre}favorites f WHERE f.gid=g.gid GROUP BY f.gid ORDER BY topic DESC LIMIT 0,8"); while($arr = $db->fetch_array($query)){ $topnum++; $arr['top'] = $topnum; $arr['photo'] = array_shift(unserialize($arr['photos'])); $arr['zprice'] = number_format($arr['eprice'] * ($arr['discount'] / 10), 2,'.',''); $toparr['favortops'][] = $arr; } //最近更新 $toparr['updatetops'] = array(); $topnum = 0; $query = $db->query("SELECT gid,subject,eprice,discount,photos FROM {$tablepre}goods ORDER BY lastupdate DESC LIMIT 0,8"); while($arr = $db->fetch_array($query)){ $topnum++; $arr['top'] = $topnum; $arr['photo'] = array_shift(unserialize($arr['photos'])); $arr['zprice'] = number_format($arr['eprice'] * ($arr['discount'] / 10), 2,'.',''); $toparr['updatetops'][] = $arr; } //评价数量更新 $pjnum = $db->result_first("SELECT COUNT(rid) FROM {$tablepre}goodsreplys WHERE `check`=1"); $_MCACHE['settings']['replynum'] = $pjnum; updatesettings(); writetocache('indextops',arrayeval($toparr)); $db->query("UPDATE {$tablepre}timingdo SET `lastupdate`='$nowdate',`mark`='执行成功!' WHERE tid='$akr[tid]'"); updatecache('crons'); ?>