AI智能回复搜索中,请稍后...
在model/article.php添加如下函数,你在app/explore/main.php调用这个函数。剩下的你应该知道怎么在侧边栏显示这个返回值了。
public function get_hot_comments($day, $limit) { if ($comments = $this->fetch_all('article_comments', 'add_time > ' . (time() - (60 * 60 * 24 * $day)), 'votes DESC', $limit, 0)) { foreach ($comments AS $key => $val) { $comment_uids[$val['uid']] = $val['uid']; $article_ids[$val['article_id']] = $val['article_id']; } if ($comment_uids) { $comment_user_infos = $this->model('account')->get_user_info_by_uids($comment_uids); } if ($article_ids) { $article_infos = $this->model('article')->get_article_info_by_ids($article_ids); } foreach ($comments AS $key => $val) { $s_comments[$key]['message'] = $comments[$key]['message']; $s_comments[$key]['user_name'] = $comment_user_infos[$val['uid']]['user_name']; $s_comments[$key]['uid'] = $comment_user_infos[$val['uid']]['uid']; $s_comments[$key]['url_token'] = $comment_user_infos[$val['uid']]['url_token']; $s_comments[$key]['title'] = $article_infos[$val['article_id']]['title']; $s_comments[$key]['article_id'] = $article_infos[$val['article_id']]['id']; } } return $s_comments; }