Skip to content

Commit 8172090

Browse files
fix: 优化首页查询效率
1 parent 63ee4e1 commit 8172090

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

service/app/controller/blog/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class IndexController extends controller {
5858
article_type.name as type
5959
FROM article LEFT JOIN article_type
6060
ON article.type_id = article_type.id WHERE article.is_publish = 1 ORDER BY article.publish_time DESC LIMIT ?,?`;
61-
const articleListPromise = await this.app.mysql.query(sql, [ request.offset, request.limit ]);
62-
const countPromise = await this.app.mysql.query('SELECT (max(id)-min(id)+1) as count from novel where is_deleted = 0');
61+
const articleListPromise = this.app.mysql.query(sql, [ request.offset, request.limit ]);
62+
const countPromise = this.app.mysql.query('SELECT (max(id)-min(id)+1) as count from novel where is_deleted = 0');
6363
const [articleListResult, countResult] = await Promise.all([articleListPromise, countPromise])
6464
if (articleListResult.length > 0) {
6565
for (const item of articleListResult) {

0 commit comments

Comments
 (0)