(bookId int, ext string)
| 66 | } |
| 67 | |
| 68 | func (m *Ebook) Get2Download(bookId int, ext string) (ebook Ebook) { |
| 69 | o := orm.NewOrm() |
| 70 | o.QueryTable(m).Filter("book_id", bookId).Filter("ext", ext).OrderBy("-id").One(&ebook) |
| 71 | if ebook.Id > 0 { |
| 72 | ebook.DownloadCount = ebook.DownloadCount + 1 |
| 73 | o.Update(&ebook) |
| 74 | } |
| 75 | return |
| 76 | } |
| 77 | |
| 78 | func (m *Ebook) GetEBook(id int) (book Ebook) { |
| 79 | if id <= 0 { |