diff --git a/modules/discussion.js b/modules/discussion.js index cfcd419..b61f430 100644 --- a/modules/discussion.js +++ b/modules/discussion.js @@ -85,8 +85,8 @@ app.get('/article/:id', async (req, res) => { article.content = await syzoj.utils.markdown(article.content); let where = { article_id: id }; - - let paginate = syzoj.utils.paginate(await ArticleComment.count(where), req.query.page, syzoj.config.page.article_comment); + let commentsCount = await ArticleComment.count(where); + let paginate = syzoj.utils.paginate(commentsCount, req.query.page, syzoj.config.page.article_comment); let comments = await ArticleComment.query(paginate, where, [['public_time', 'desc']]); @@ -108,7 +108,8 @@ app.get('/article/:id', async (req, res) => { article: article, comments: comments, paginate: paginate, - problem: problem + problem: problem, + commentsCount: commentsCount }); } catch (e) { syzoj.log(e); diff --git a/views/article.ejs b/views/article.ejs index c363d59..0dc878f 100644 --- a/views/article.ejs +++ b/views/article.ejs @@ -49,7 +49,7 @@ <% if (comments.length) { %>
共 <%= comments.length %> 条回复
+共 <%= commentsCount %> 条回复
<% for (let comment of comments) { %>