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

Method Generate

controllers/BookController.go:835–861  ·  view source on GitHub ↗

生成电子书

()

Source from the content-addressed store, hash-verified

833
834// 生成电子书
835func (this *BookController) Generate() {
836 identify := this.GetString(":key")
837
838 if !models.NewBook().HasProjectAccess(identify, this.Member.MemberId, conf.BookAdmin) {
839 this.JsonResult(1, "您没有操作权限,只有书籍创始人和书籍管理员才有权限")
840 }
841
842 book, err := models.NewBook().FindByIdentify(identify)
843 if err != nil {
844 beego.Error(err)
845 this.JsonResult(1, "书籍不存在")
846 }
847
848 ebookModel := models.NewEbook()
849
850 // 电子书不是处于完成状态,不允许再添加到电子书生成队列中
851 if ok := ebookModel.IsFinish(book.BookId); !ok {
852 this.JsonResult(1, "电子书生成任务已在处理中,如需再次生成,请您稍后再试。")
853 }
854
855 // 添加到电子书生成队列
856 if err = ebookModel.AddToGenerate(book.BookId); err != nil {
857 this.JsonResult(1, err.Error())
858 }
859
860 this.JsonResult(0, "电子书生成任务已交由后台执行,请您耐心等待。")
861}
862
863// 文档排序.
864func (this *BookController) SaveSort() {

Callers

nothing calls this directly

Calls 7

IsFinishMethod · 0.95
AddToGenerateMethod · 0.95
NewBookFunction · 0.92
NewEbookFunction · 0.92
HasProjectAccessMethod · 0.80
JsonResultMethod · 0.80
FindByIdentifyMethod · 0.45

Tested by

no test coverage detected