![]() |
TopicModel.selectAllByForumByLimit = SELECT t.*, p.user_id AS last_user_id, p.post_time, (SELECT SUM(p.attach) \
FROM jforum_posts p \
WHERE p.topic_id = t.topic_id \
AND p.need_moderate = 0) AS attach \
FROM jforum_topics t, jforum_posts p \
WHERE (t.forum_id = ? OR t.topic_moved_id = ?) \
AND p.post_id = t.topic_last_post_id \
AND p.need_moderate = 0 \
ORDER BY t.topic_type DESC, t.topic_last_post_id DESC \
OFFSET ? LIMIT ?
TopicModel.selectByUserByLimit = SELECT t.*, p.user_id AS last_user_id, p.post_time, (SELECT SUM(p.attach) \
FROM jforum_posts p \
WHERE p.topic_id = t.topic_id \
AND p.need_moderate = 0) AS attach \
FROM jforum_topics t, jforum_posts p \
WHERE p.post_id = t.topic_last_post_id \
AND t.user_id = ? \
AND p.need_moderate = 0 \
AND t.forum_id IN(:fids:) \
ORDER BY t.topic_last_post_id DESC \
OFFSET ? LIMIT ?
attachments.insertAttachments(p);
t.setHasAttach(t.hasAttach() || p.hasAttachments());
attachments.insertAttachments(post);
t.setHasAttach(t.hasAttach() || post.hasAttachments());