优化代码

pull/358/head
lifei6671 2018-07-22 17:28:54 +08:00
parent cc32b6e8a7
commit 969fd44b9c
2 changed files with 1 additions and 4 deletions

View File

@ -79,7 +79,7 @@ func (c *BlogController) List() {
blogList,totalCount,err = models.NewBlog().FindToPager(pageIndex,conf.PageSize,0,"") blogList,totalCount,err = models.NewBlog().FindToPager(pageIndex,conf.PageSize,0,"")
if err != nil { if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500,err.Error()) c.ShowErrorPage(500,err.Error())
} }
if totalCount > 0 { if totalCount > 0 {

View File

@ -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) _,err = query.OrderBy("-order_index","-blog_id").Offset(offset).Limit(pageSize).All(&blogList)
if err != nil { if err != nil {
if err == orm.ErrNoRows {
return
}
beego.Error("获取文章列表时出错 ->",err) beego.Error("获取文章列表时出错 ->",err)
return return
} }