MCPcopy Index your code
hub / github.com/TruthHun/BookStack / ReadBook

Method ReadBook

controllers/DocumentController.go:498–522  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

496}
497
498func (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// 编辑文档.
525func (this *DocumentController) Edit() {

Callers

nothing calls this directly

Calls 4

NewBookFunction · 0.92
NewDocumentFunction · 0.92
FirstChapterMethod · 0.80
FindByIdentifyMethod · 0.45

Tested by

no test coverage detected