From a698267d9e726ef2c15fe4587a1a57326c799950 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Mon, 3 Nov 2025 14:29:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9C=AA=E5=8F=91=E5=B8=83=E5=8D=9A=E5=AE=A2=E6=97=A0=E9=98=85?= =?UTF-8?q?=E8=AF=BB=E6=AC=A1=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/blog_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/blog_service.py b/service/blog_service.py index ff891e8..188c708 100644 --- a/service/blog_service.py +++ b/service/blog_service.py @@ -93,12 +93,15 @@ def query_unapproved_blog(db: Session) -> List[BlogResponse]: BlogContent.content.label("content"), Blog.word_count.label("wordCount"), Blog.read_duration.label("readDuration"), + func.count(BlogVisit.id).label("visitCount"), Blog.is_approved.label("isApproved"), Blog.create_time.label("createTime"), Blog.update_time.label("updateTime") ).where(Blog.is_approved == 0) .outerjoin(BlogCategory, Blog.category_id == BlogCategory.id) .outerjoin(BlogContent, Blog.content_id == BlogContent.id)) + .outerjoin(BlogVisit, Blog.id == BlogVisit.blog_id) + .group_by(Blog.id) .order_by(desc(Blog.update_time))) results = db.execute(stmt).fetchall()