修复只有第一次导入docx文件有效问题

pull/828/head
Rebellioncry 2022-11-30 14:15:12 +08:00
parent d43010640b
commit ade6734779
2 changed files with 23 additions and 22 deletions

View File

@ -622,6 +622,9 @@ func (c *BookController) Import() {
tempPath = filepath.Join(tempPath, moreFile.Filename) tempPath = filepath.Join(tempPath, moreFile.Filename)
err = c.SaveToFile("import-file", tempPath) err = c.SaveToFile("import-file", tempPath)
if err != nil {
c.JsonResult(6004, i18n.Tr(c.Lang, "message.upload_failed"))
}
book := models.NewBook() book := models.NewBook()

View File

@ -1038,8 +1038,6 @@ func (book *Book) ImportWordBook(docxPath string, lang string) (err error) {
doc.DocumentName = strings.TrimSpace(docName) doc.DocumentName = strings.TrimSpace(docName)
doc.DocumentId = book.MemberId
if err := doc.InsertOrUpdate("document_name", "book_id", "markdown", "content"); err != nil { if err := doc.InsertOrUpdate("document_name", "book_id", "markdown", "content"); err != nil {
logs.Error(doc.DocumentId, err) logs.Error(doc.DocumentId, err)
} }