花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊 退出 找回密碼

論壇人氣弱?Discuz帖子刷新后閱讀數(shù)進(jìn)行隨機(jī)值增加方法

時(shí)間: 2019-05-29 11:11 閱讀: 作者:素材無憂網(wǎng)

論壇人氣弱?想改閱讀數(shù)的站長可以圍觀!

找到:source/module/forum/forum_viewthread.php文件

搜索代碼:
function viewthread_updateviews($tableid)

找到代碼:
function viewthread_updateviews($tableid) {

        global $_G;



        if(!$_G['setting']['preventrefresh'] || $_G['cookie']['viewid'] != 'tid_'.$_G['tid']) {

                if(!$tableid && $_G['setting']['optimizeviews']) {

                        if($_G['forum_thread']['addviews']) {

                                if($_G['forum_thread']['addviews'] < 100) {

                                        C::t('forum_threadaddviews')->update_by_tid($_G['tid']);

                                } else {

                                        if(!discuz_process::islocked('update_thread_view')) {

                                                $row = C::t('forum_threadaddviews')->fetch($_G['tid']);

                                                C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => 0));

                                                C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+1), true);

                                                discuz_process::unlock('update_thread_view');

                                        }

                                }

                        } else {

                                C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => 1), false, true);

                        }

                } else {

                        C::t('forum_thread')->increase($_G['tid'], array('views' => 1), true, $tableid);

                }

        }

        dsetcookie('viewid', 'tid_'.$_G['tid']);

}

修改為:
function viewthread_updateviews($tableid) {

        global $_G;


        $viewrand = rand(2,10); 


        if(!$_G['setting']['preventrefresh'] || $_G['cookie']['viewid'] != 'tid_'.$_G['tid']) {
                
                if(!$tableid && $_G['setting']['optimizeviews']) {

                        if($_G['forum_thread']['addviews']) {

                                if($_G['forum_thread']['addviews'] < 100) {

                                        C::t('forum_threadaddviews')->update_by_tid($_G['tid']);

                                } else {

                                        if(!discuz_process::islocked('update_thread_view')) {

                                                $row = C::t('forum_threadaddviews')->fetch($_G['tid']);

                                                C::t('forum_threadaddviews')->update($_G['tid'], array('addviews' => $viewrand));

                                                C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+$viewrand), true);

                                                discuz_process::unlock('update_thread_view');

                                        }

                                }

                        } else {

                                C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => $viewrand), false, true);

                        }

                } else {

                        C::t('forum_thread')->increase($_G['tid'], array('views' => $viewrand), true, $tableid);

                }

        }

        dsetcookie('viewid', 'tid_'.$_G['tid']);

}

主要修改的是:

1.創(chuàng)建隨機(jī)數(shù)變量:
$viewrand = rand(2,10);

rand(2,10)表示的2-10之間的隨機(jī)數(shù);

2.修改原有的幾個(gè)更新方法:

分別是:

       C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+1), true);
  C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => 1), false, true);
  C::t('forum_thread')->increase($_G['tid'], array('views' => 1), true, $tableid);

改為:

       C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+$viewrand), true);
  C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => $viewrand), false, true);
  C::t('forum_thread')->increase($_G['tid'], array('views' => $viewrand), true, $tableid);


就好了!

版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會(huì)員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時(shí)內(nèi)刪除!謝謝!

轉(zhuǎn)載請注明: 論壇人氣弱?Discuz帖子刷新后閱讀數(shù)進(jìn)行隨機(jī)值增加方法

標(biāo)簽:  
相關(guān)文章
模板推薦