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

Method Release

controllers/BookController.go:801–832  ·  view source on GitHub ↗

发布书籍.

()

Source from the content-addressed store, hash-verified

799
800// 发布书籍.
801func (this *BookController) Release() {
802 identify := this.GetString("identify")
803 force, _ := this.GetBool("force")
804 bookId := 0
805 if this.Member.IsAdministrator() {
806 book, err := models.NewBook().FindByFieldFirst("identify", identify)
807 if err != nil {
808 beego.Error(err)
809 }
810 bookId = book.BookId
811 } else {
812 book, err := models.NewBookResult().FindByIdentify(identify, this.Member.MemberId)
813 if err != nil {
814 if err == models.ErrPermissionDenied {
815 this.JsonResult(6001, "权限不足")
816 }
817 if err == orm.ErrNoRows {
818 this.JsonResult(6002, "书籍不存在")
819 }
820 beego.Error(err)
821 this.JsonResult(6003, "未知错误")
822 }
823 if book.RoleId != conf.BookAdmin && book.RoleId != conf.BookFounder && book.RoleId != conf.BookEditor {
824 this.JsonResult(6003, "权限不足")
825 }
826 bookId = book.BookId
827 }
828
829 go models.NewDocument().ReleaseContent(bookId, this.BaseUrl(), force)
830
831 this.JsonResult(0, "发布任务已推送到任务队列,稍后将在后台执行。")
832}
833
834// 生成电子书
835func (this *BookController) Generate() {

Callers

nothing calls this directly

Calls 9

NewBookFunction · 0.92
NewBookResultFunction · 0.92
NewDocumentFunction · 0.92
IsAdministratorMethod · 0.80
JsonResultMethod · 0.80
ReleaseContentMethod · 0.80
BaseUrlMethod · 0.80
FindByFieldFirstMethod · 0.45
FindByIdentifyMethod · 0.45

Tested by

no test coverage detected