fix:修复删除项目失败的BUG

pull/358/head
lifei6671 2018-08-15 16:00:04 +08:00
parent 63c5716dfb
commit 42dbe12f6b
1 changed files with 4 additions and 2 deletions

View File

@ -372,7 +372,7 @@ func (book *Book) ThoroughDeleteBook(id int) error {
o.Begin() o.Begin()
//删除附件,这里没有删除实际物理文件 //删除附件,这里没有删除实际物理文件
_,err = o.Raw("DELETE FROM " + NewAttachment().TableNameWithPrefix() + " WHERE book_id=?").Exec() _,err = o.Raw("DELETE FROM " + NewAttachment().TableNameWithPrefix() + " WHERE book_id=?",book.BookId).Exec()
if err != nil { if err != nil {
o.Rollback() o.Rollback()
return err return err
@ -411,7 +411,9 @@ func (book *Book) ThoroughDeleteBook(id int) error {
NewLabel().InsertOrUpdateMulti(book.Label) NewLabel().InsertOrUpdateMulti(book.Label)
} }
os.RemoveAll(filepath.Join(conf.WorkingDirectory, "uploads", "books", strconv.Itoa(id))) if err := os.RemoveAll(filepath.Join(conf.GetExportOutputPath(), strconv.Itoa(id))); err != nil {
beego.Error("删除项目缓存失败 ->",err)
}
return o.Commit() return o.Commit()