From 6ca1515462c6949cb7a1078e9532f2036585417a Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Wed, 28 Nov 2018 09:56:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=B7=B3=E8=BD=AC=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/HomeController.go | 6 +++--- models/BookModel.go | 2 +- models/Itemsets.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/HomeController.go b/controllers/HomeController.go index f12bb84f2..8d63717f5 100644 --- a/controllers/HomeController.go +++ b/controllers/HomeController.go @@ -28,12 +28,12 @@ func (c *HomeController) Index() { pageIndex, _ := c.GetInt("page", 1) pageSize := 18 - member_id := 0 + memberId := 0 if c.Member != nil { - member_id = c.Member.MemberId + memberId = c.Member.MemberId } - books, totalCount, err := models.NewBook().FindForHomeToPager(pageIndex, pageSize, member_id) + books, totalCount, err := models.NewBook().FindForHomeToPager(pageIndex, pageSize, memberId) if err != nil { beego.Error(err) diff --git a/models/BookModel.go b/models/BookModel.go index 1e17e1ed8..d97edd1c2 100644 --- a/models/BookModel.go +++ b/models/BookModel.go @@ -499,7 +499,7 @@ WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0` as t group by book_id) as team on team.book_id=book.book_id 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.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0 ORDER BY order_index ,book.book_id DESC LIMIT ?,?` +WHERE book.privately_owned = 0 or rel.role_id >=0 or team.role_id >=0 ORDER BY order_index desc,book.book_id DESC LIMIT ?,?` _, err = o.Raw(sql2, memberId, memberId, offset, pageSize).QueryRows(&books) diff --git a/models/Itemsets.go b/models/Itemsets.go index 4a014b62a..8978d1989 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 ,book.book_id DESC LIMIT ?,?` + ORDER BY order_index desc,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 ,book.book_id DESC LIMIT ?,?` + WHERE book.item_id = ? AND book.privately_owned = 0 ORDER BY order_index desc,book.book_id DESC LIMIT ?,?` _, err = o.Raw(sql, item.ItemId, offset, pageSize).QueryRows(&books)