()
| 496 | } |
| 497 | |
| 498 | func (this *DocumentController) ReadBook() { |
| 499 | identify := this.Ctx.Input.Param(":key") |
| 500 | if identify == "" { |
| 501 | this.Abort("404") |
| 502 | return |
| 503 | } |
| 504 | |
| 505 | book, err := models.NewBook().FindByIdentify(identify, "book_id") |
| 506 | if err != nil || book.BookId == 0 { |
| 507 | this.Abort("404") |
| 508 | return |
| 509 | } |
| 510 | |
| 511 | doc, err := models.NewDocument().FirstChapter(book.BookId, "document_id", "identify") |
| 512 | if err != nil || doc.DocumentId == 0 { |
| 513 | this.Abort("404") |
| 514 | return |
| 515 | } |
| 516 | |
| 517 | if sign := this.GetString("sign"); sign != "" { |
| 518 | this.SetSession(book.BookId, sign) |
| 519 | } |
| 520 | |
| 521 | this.Redirect(beego.URLFor("DocumentController.Read", ":key", identify, ":id", doc.Identify), 302) |
| 522 | } |
| 523 | |
| 524 | // 编辑文档. |
| 525 | func (this *DocumentController) Edit() { |
nothing calls this directly
no test coverage detected