http://www.phpwind.net/searcher.php?sch_time=newatclib/forum/db/threadsdb.class.php
function getLatestThreadsCount($forumIds, $starttime, $endtime){
$_sql_where=$this->_getFilterids();
if ($forumIds) {
$forumIds = (is_array ( $forumIds )) ? $forumIds : array ($forumIds );
$_sql_where .= " AND t.fid IN(" . S::sqlImplode ( $forumIds ) . ")";
}
if ($starttime) {
$ifpostdate = 1;
$_sql_where .= " AND t.postdate > " . S::sqlEscape ( $starttime );
}
if ($endtime) {
$ifpostdate = 1;
$_sql_where .= " AND t.postdate < " . S::sqlEscape ( $endtime );
}
if ($ifpostdate == 1) {
$forceIndex = 'FORCE INDEX (idx_postdate)';
}
$total=$this->countSearch("SELECT count(*) as total FROM ".$this->_tableName." t ".$forceIndex." WHERE t.ifcheck = 1 AND t.fid !=0 ".$_sql_where);
return ($total<500) ? $total : 500;
}
改成
function getLatestThreadsCount($forumIds, $starttime, $endtime){
/*
$_sql_where=$this->_getFilterids();
if ($forumIds) {
$forumIds = (is_array ( $forumIds )) ? $forumIds : array ($forumIds );
$_sql_where .= " AND t.fid IN(" . S::sqlImplode ( $forumIds ) . ")";
}
if ($starttime) {
$ifpostdate = 1;
$_sql_where .= " AND t.postdate > " . S::sqlEscape ( $starttime );
}
if ($endtime) {
$ifpostdate = 1;
$_sql_where .= " AND t.postdate < " . S::sqlEscape ( $endtime );
}
if ($ifpostdate == 1) {
$forceIndex = 'FORCE INDEX (idx_postdate)';
}
$total=$this->countSearch("SELECT count(*) as total FROM ".$this->_tableName." t ".$forceIndex." WHERE t.ifcheck = 1 AND t.fid !=0 ".$_sql_where);
return ($total<500) ? $total : 500;
*/
return 500;
}
这也速度上比较快 功能有小小牺牲 总比服务器挂了好点