/** * [LUPA!] * XIAOJIE5525@163.COM * * $Id: 自动更新文章的查看数 $ */ $dateline = TIMESTAMP - 3600 * 24 * 3;//7天内 $wheresql=" 1=1 "; $query = C::t('portal_article_count')->fetch_all_newarticle($wheresql, $dateline); foreach($query as $value) { $aid=$value['aid']; $article_count = C::t('portal_article_count')->fetch($aid); if($article_count) $article = array_merge($article_count, $article); if($article_count) { $viewnum=rand(10,20);//每次所加的查看数 C::t('portal_article_count')->increase($aid, array('viewnum'=>$viewnum)); unset($article_count); } else { C::t('portal_article_count')->insert(array( 'aid'=>$aid, 'catid'=>$article['catid'], 'viewnum'=>1)); } } ?>