feat:1、修复无数据时报错的问题。

2、新增自定义代码着色格式
3、新增自动加载配置文件
This commit is contained in:
lifei6671
2018-08-07 17:19:56 +08:00
parent c0c3db6c50
commit 327d6fb8d8
280 changed files with 162 additions and 98 deletions

View File

@@ -44,18 +44,18 @@ func (c *LabelController) Index() {
c.Abort("500")
}
}
member_id := 0
memberId := 0
if c.Member != nil {
member_id = c.Member.MemberId
memberId = c.Member.MemberId
}
searchResult, totalCount, err := models.NewBook().FindForLabelToPager(labelName, pageIndex, conf.PageSize, member_id)
searchResult, totalCount, err := models.NewBook().FindForLabelToPager(labelName, pageIndex, conf.PageSize, memberId)
if err != nil {
beego.Error(err)
return
if err != nil && err != orm.ErrNoRows {
beego.Error("查询标签时出错 ->", err)
c.ShowErrorPage(500, "查询文档列表时出错")
}
if totalCount > 0 {
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize,c.BaseUrl())
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
c.Data["PageHtml"] = pager.HtmlPages()
} else {
c.Data["PageHtml"] = ""
@@ -74,8 +74,8 @@ func (c *LabelController) List() {
labels, totalCount, err := models.NewLabel().FindToPager(pageIndex, pageSize)
if err != nil {
c.ShowErrorPage(50001, err.Error())
if err != nil && err != orm.ErrNoRows {
c.ShowErrorPage(500, err.Error())
}
if totalCount > 0 {
pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())