本帖最后由 taihom 于 2010-7-21 15:09 编辑
写这个之前,我也遇到了论坛上众多站长提出的这个问题,这个问题从5月份一直在官方网站提出,然后下砂说已经记录,6月X的正式版本也没修复,到了现在7月低,一直都没解决。我实在不知道,为什么官方会这么久不解决这个问题?找了两三天了都没一个可行的解决办法!
这个问题实在是不难解决的吧?
我升级到X1后,对新的DZ结构不是很熟悉,花了点时间读读代码后,决定自己动手修复这个BUG。
现在已经找到原因了。官方的查询代码是:
SELECT m . * , mc . *
FROM molihua_common_member_count mc
LEFT JOIN molihua_common_member m ON mc.uid = m.uid
LEFT JOIN molihua_common_member_status ms ON m.uid = ms.uid
WHERE ms.lastpost > '1279602038'
ORDER BY mc.posts DESC
LIMIT 0 , 10
这个怎么可能是今日发帖排行嘛??真是想不明白了!
正确的查询应该是:
SELECT m.*,count(mp.pid) as posts,sum(mp.first) as threads,mc.*
FROM `molihua_forum_post` mp LEFT JOIN molihua_common_member m ON mp.authorid=m.uid
LEFT JOIN molihua_common_member_count mc ON mc.uid = m.uid
Where Dateline>'1279602038' Group by mp.authorid Order by Count(mp.pid) Desc
LIMIT 0 , 10
我现在还在修改测试代码,等下弄好了放出来给大家。
顺便贴出我的坛子:http://hx.gx.cn
我不解的是你官方不解决你也要有一个态度吧?自己没这么多精力解决,那悬赏让广大网友来做行不行?
代码修复如下:
在source\class\block\block_member.php 第 147行左右,找到
case 'posts':
把里面的
$query = DB::query("SELECT m.*, mc.* FROM $tablesql2 WHERE $sqllastpost $sqlgroupid $sqlban ORDER BY mc.posts DESC LIMIT $startrow, $items");
这一行替换成下面的代码,更新一下缓存,既可。- $exesql = "SELECT m.*, mc.* FROM $tablesql2 WHERE $sqllastpost $sqlgroupid $sqlban ORDER BY mc.posts DESC LIMIT $startrow, $items";
- $fields = 'm.*,count(mp.pid) as posts,sum(mp.first) as threads,mc.extcredits1,mc.extcredits2,mc.extcredits3,mc.extcredits4,mc.extcredits5,mc.extcredits6,mc.extcredits7,mc.extcredits8,mc.friends,mc.digestposts,mc.doings,mc.blogs,mc.albums,mc.sharings,mc.attachsize,mc.views';
-
- $tablesql = DB::table('forum_post')." as mp LEFT JOIN ".DB::table('common_member')." as m ON mp.authorid=m.uid LEFT JOIN ".DB::table('common_member_count')." as mc ON mc.uid = m.uid ";
-
- if($lastpost) {//if have lastpost
- $time = TIMESTAMP - $lastpost;
- $where = " mp.Dateline>'$time' ";
- $exesql = "SELECT $fields FROM $tablesql WHERE $where Group by mp.authorid Order by Count(mp.pid) Desc LIMIT $startrow, $items";
- }
-
- $query = DB::query($exesql);
复制代码 不知道怎么样修改的,或者下载一下附件,覆盖一下
source\class\block\block_member.php
|