1、找到文件:source\module\forum下,forum_viewthread.php
2、找到1021行到1058行左右源代码如下
搜索
- function viewthread_updateviews($tableid) {
- global $_G;
复制代码
修改为:
- function viewthread_updateviews($tableid) {
- global $_G;
- $viewrnd=rand(1,10);
复制代码
搜索
- 'views' => $row['addviews']+1
复制代码
修改为:
- 'views' => $row['addviews']+$viewrnd
复制代码
搜索
修改为:
搜索
修改为:
完修改代码如下:
- function viewthread_updateviews($tableid) {
- global $_G;
- $viewrnd=rand(1,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' => 0));
- C::t('forum_thread')->increase($_G['tid'], array('views' => $row['addviews']+$viewrnd), true);
- discuz_process::unlock('update_thread_view');
- }
- }
- } else {
- C::t('forum_threadaddviews')->insert(array('tid' => $_G['tid'], 'addviews' => $viewrnd), false, true);
- }
- } else {
- C::t('forum_thread')->increase($_G['tid'], array('views' => $viewrnd), true, $tableid);
- }
- }
- dsetcookie('viewid', 'tid_'.$_G['tid']);
复制代码
3.保存。替换同名文件,更新缓存,完成 |