From 969fd44b9c9d9ce4f31216538643028c0c933312 Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Sun, 22 Jul 2018 17:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/BlogController.go | 2 +- models/Blog.go | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/controllers/BlogController.go b/controllers/BlogController.go index 800278b7..b16f1936 100644 --- a/controllers/BlogController.go +++ b/controllers/BlogController.go @@ -79,7 +79,7 @@ func (c *BlogController) List() { blogList,totalCount,err = models.NewBlog().FindToPager(pageIndex,conf.PageSize,0,"") - if err != nil { + if err != nil && err != orm.ErrNoRows { c.ShowErrorPage(500,err.Error()) } if totalCount > 0 { diff --git a/models/Blog.go b/models/Blog.go index 1d6bdcb9..f296ebe2 100644 --- a/models/Blog.go +++ b/models/Blog.go @@ -219,9 +219,6 @@ func (b *Blog) FindToPager(pageIndex, pageSize int,memberId int,status string) ( _,err = query.OrderBy("-order_index","-blog_id").Offset(offset).Limit(pageSize).All(&blogList) if err != nil { - if err == orm.ErrNoRows { - return - } beego.Error("获取文章列表时出错 ->",err) return }