实现导入Markdown

This commit is contained in:
Minho
2018-03-25 14:59:42 +08:00
parent 74df816f38
commit 6a49b8a42f
6 changed files with 210 additions and 170 deletions

View File

@@ -473,7 +473,7 @@ func (c *BookController) Create() {
}
}
if books, _ := book.FindByField("identify", identify); len(books) > 0 {
if books, _ := book.FindByField("identify", identify,"book_id"); len(books) > 0 {
c.JsonResult(6006, "项目标识已存在")
}
@@ -543,6 +543,10 @@ func (c *BookController) Import() {
c.JsonResult(6004, "不支持的文件类型")
}
if books, _ := models.NewBook().FindByField("identify", identify,"book_id"); len(books) > 0 {
c.JsonResult(6006, "项目标识已存在")
}
tempPath := filepath.Join(os.TempDir(), c.CruSession.SessionID())
os.MkdirAll(tempPath, 0766)
@@ -676,7 +680,7 @@ func (c *BookController) Release() {
bookId = book.BookId
}
go func(identify string) {
models.NewDocument().ReleaseContent(bookId)
models.NewBook().ReleaseContent(bookId)
//当文档发布后,需要删除已缓存的转换项目
outputPath := filepath.Join(beego.AppConfig.DefaultString("book_output_path", "cache"), strconv.Itoa(bookId))