因为是采集站,并且也采集了帖子时间。
发现一个问题就是,程序是按照 tid 或者 lastpid 进行排序的,
而不是根据帖子的发布/回复时间进行排序。
(亲测) 而 DZ 论坛,刚好和修罗相反,是根据 帖子时间 进行排序,而不是帖子 id.
请问该如何调整?有知道的大佬吗》
是修改这部分吗 model/thread.func.php ? 该怎么修改呢。 数据库里的表是 create_date 和 last_date
- // 查找 lastpid
- function thread_find_lastpid($tid) {
- $arr = db_find_one("post", array(‘tid’=>$tid), array(‘pid’=>-1), array(‘pid’));
- $lastpid = empty($arr) ? 0 : $arr[‘pid’];
- return $lastpid;
- }
- // 更新最后的 uid pid
- function thread_update_last($tid) {
- $lastpid = thread_find_lastpid($tid);
- if(empty($lastpid)) return;
- $lastpost = post__read($lastpid);
- if(empty($lastpost)) return;
- $r = thread__update($tid, array(‘lastpid’=>$lastpid, ‘lastuid’=>$lastpost[‘uid’], ‘last_date’=>$lastpost[‘create_date’]));
- return $r;
- }
复制代码
山西网友:
编辑: 错了
山东网友:https://bbs.xiuno.com/thread-151982.htm
活捉楼主
西藏网友:正经技术贴没人理 太难受了
香港网友:主要是 一般来说 帖子时间不是决定了帖子id么。。。
帖子id是根据每个新帖子 自动升序
江西网友:如果你是需要按顶贴时间来排序的话
model/thread.class.php 41 行:
$newlist = $this->thread_new->index_fetch(array(), array(‘tid’=>-1), $start, $limit);
改为:
$newlist = $this->thread_new->index_fetch(array(), array(‘lastpost’=>-1), $start, $limit);
清空 tmp 目录后生效。
台湾网友:数据库:多简单个事,根据发贴时间把ID刷一遍不就完了。
四川网友:不会写命令….. 大佬 求命令,
时间的是 create_date 帖子是 tid,
表名是 forum. 表前缀是 bbs_
未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » 修罗bbs 没办法按照时间排序。