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 }