渲染生成封面截图
()
| 67 | |
| 68 | // 渲染生成封面截图 |
| 69 | func (this *LocalhostController) RenderCover() { |
| 70 | identify := this.GetString("id") |
| 71 | id, err := strconv.Atoi(identify) |
| 72 | if identify == "" && err != nil { |
| 73 | this.Abort("404") |
| 74 | return |
| 75 | } |
| 76 | book := models.NewBook() |
| 77 | q := orm.NewOrm().QueryTable(book) |
| 78 | if id > 0 { |
| 79 | err = q.Filter("book_id", id).One(book) |
| 80 | } else { |
| 81 | err = q.Filter("identify", identify).One(book) |
| 82 | } |
| 83 | if err != nil { |
| 84 | beego.Error(err) |
| 85 | } |
| 86 | if book.BookId == 0 { |
| 87 | this.Abort("404") |
| 88 | return |
| 89 | } |
| 90 | this.Data["Book"] = book |
| 91 | this.TplName = "ebook/cover.html" |
| 92 | } |