论坛风格切换
离线top
 

发帖
336
金币
0
威望
59
只看楼主 倒序阅读 使用道具 楼主  发表于: 2012-05-02
http://www.phpwind.net/searcher.php?sch_time=newatc

lib/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;
    }

这也速度上比较快 功能有小小牺牲  总比服务器挂了好点
2条评分bug优化分+1金币+1
云天河 金币 +1 - 2012-05-02
云天河 bug优化分 +1 给你个好评哦亲~ 2012-05-02
离线top

发帖
336
金币
0
威望
59
只看该作者 沙发  发表于: 2012-05-23
下面的
    function _getLatestThreads($forumIds, $starttime, $endtime, $offset, $limit){
        $_sql_where=$this->_getFilterids();
        
        if ($forumIds) {
            $forumIds = (is_array ( $forumIds )) ? $forumIds : array ($forumIds );
            $_sql_where .= " AND t.fid IN(" . S::sqlImplode ( $forumIds ) . ")";
        }
        
        if ($starttime) {
            $_sql_where .= " AND t.postdate > " . S::sqlEscape ( $starttime );
        }
        
        if ($endtime) {
            $_sql_where .= " AND t.postdate < " . S::sqlEscape ( $endtime );
        }
        
        $query = $this->_db->query ("SELECT t.tid FROM ".$this->_tableName." t WHERE t.ifcheck = 1 AND t.ifshield != 1 ".$_sql_where." ORDER BY t.postdate DESC LIMIT " . $offset . "," . $limit );
        return $this->_getAllResultFromQuery ( $query );
    }

改成 试试

    function _getLatestThreads($forumIds, $starttime, $endtime, $offset, $limit){
        $_sql_where=$this->_getFilterids();
        
        if ($forumIds) {
            $forumIds = (is_array ( $forumIds )) ? $forumIds : array ($forumIds );
            $_sql_where .= " AND t.fid IN(" . S::sqlImplode ( $forumIds ) . ")";
        }
        
        if ($starttime) {
            $_sql_where .= " AND t.postdate > " . S::sqlEscape ( $starttime );
        }
        
        if ($endtime) {
            $_sql_where .= " AND t.postdate < " . S::sqlEscape ( $endtime );
        }
        
        $query = $this->_db->query ("SELECT t.tid FROM ".$this->_tableName." t force index ()WHERE t.ifcheck = 1 AND t.ifshield != 1 ".$_sql_where." ORDER BY t.postdate DESC LIMIT " . $offset . "," . $limit );
        return $this->_getAllResultFromQuery ( $query );
    }
快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
提到某人:
选择好友
上一个 下一个