diff --git a/controllers/HomeController.go b/controllers/HomeController.go index ba847d66..f12bb84f 100644 --- a/controllers/HomeController.go +++ b/controllers/HomeController.go @@ -48,12 +48,4 @@ func (c *HomeController) Index() { c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(pageSize))) c.Data["Lists"] = books - - labels, totalCount, err := models.NewLabel().FindToPager(1, 10) - - if err != nil { - c.Data["Labels"] = make([]*models.Label, 0) - } else { - c.Data["Labels"] = labels - } } diff --git a/controllers/ItemsetsController.go b/controllers/ItemsetsController.go index 38272d34..5b88dc25 100644 --- a/controllers/ItemsetsController.go +++ b/controllers/ItemsetsController.go @@ -23,9 +23,11 @@ func (c *ItemsetsController) Prepare() { func (c *ItemsetsController) Index() { c.Prepare() c.TplName = "items/index.tpl" + pageSize := 18 + pageIndex, _ := c.GetInt("page", 0) - items, totalCount, err := models.NewItemsets().FindToPager(pageIndex, conf.PageSize) + items, totalCount, err := models.NewItemsets().FindToPager(pageIndex, pageSize) if err != nil && err != orm.ErrNoRows { c.ShowErrorPage(500, err.Error()) @@ -38,7 +40,7 @@ func (c *ItemsetsController) Index() { } if totalCount > 0 { - pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl()) + pager := pagination.NewPagination(c.Ctx.Request, totalCount, pageSize, c.BaseUrl()) c.Data["PageHtml"] = pager.HtmlPages() } else { c.Data["PageHtml"] = "" @@ -50,6 +52,7 @@ func (c *ItemsetsController) Index() { func (c *ItemsetsController) List() { c.Prepare() c.TplName = "items/list.tpl" + pageSize := 18 itemKey := c.Ctx.Input.Param(":key") pageIndex, _ := c.GetInt("page", 1) @@ -70,13 +73,13 @@ func (c *ItemsetsController) List() { if c.Member != nil { memberId = c.Member.MemberId } - searchResult, totalCount, err := models.NewItemsets().FindItemsetsByItemKey(itemKey, pageIndex, conf.PageSize, memberId) + searchResult, totalCount, err := models.NewItemsets().FindItemsetsByItemKey(itemKey, pageIndex, pageSize, memberId) if err != nil && err != orm.ErrNoRows { c.ShowErrorPage(500, "查询文档列表时出错") } if totalCount > 0 { - pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl()) + pager := pagination.NewPagination(c.Ctx.Request, totalCount, pageSize, c.BaseUrl()) c.Data["PageHtml"] = pager.HtmlPages() } else { c.Data["PageHtml"] = "" diff --git a/models/Itemsets.go b/models/Itemsets.go index d0f96fe7..4a014b62 100644 --- a/models/Itemsets.go +++ b/models/Itemsets.go @@ -244,7 +244,7 @@ as t group by book_id) as team LEFT JOIN md_relationship AS rel1 ON rel1.book_id = book.book_id AND rel1.role_id = 0 LEFT JOIN md_members AS member ON rel1.member_id = member.member_id WHERE book.item_id = ? AND (book.privately_owned = 0 or rel.role_id >= 0 or team.role_id >= 0) - ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?` + ORDER BY order_index ,book.book_id DESC LIMIT ?,?` _, err = o.Raw(sql2, memberId, memberId, item.ItemId, offset, pageSize).QueryRows(&books) @@ -262,7 +262,7 @@ as t group by book_id) as team sql := `SELECT book.*,rel.*,member.account AS create_name FROM md_books AS book LEFT JOIN md_relationship AS rel ON rel.book_id = book.book_id AND rel.role_id = 0 LEFT JOIN md_members AS member ON rel.member_id = member.member_id - WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index DESC ,book.book_id DESC LIMIT ?,?` + WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index ,book.book_id DESC LIMIT ?,?` _, err = o.Raw(sql, item.ItemId, offset, pageSize).QueryRows(&books) diff --git a/views/home/index.tpl b/views/home/index.tpl index d0d97a01..eceb9cfd 100644 --- a/views/home/index.tpl +++ b/views/home/index.tpl @@ -21,20 +21,7 @@ {{template "widgets/header.tpl" .}}