Skip to content

Commit eee8f32

Browse files
feat: 新增更新访问量的接口
1 parent 4112337 commit eee8f32

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

service/app/controller/blog/articledetail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class ArticleDetailController extends controller {
3939
article
4040
SET view_count = view_count + 1
4141
WHERE article.id = ? AND article.is_publish = 1`;
42-
const result = await this.app.mysql.query(sql, [id]);
43-
if (result.length > 0) {
42+
const updateResult = await this.app.mysql.query(sql, [id]);
43+
if (updateResult.affectedRows === 1) {
4444
this.ctx.body = {
4545
success: true,
4646
};

0 commit comments

Comments
 (0)