From 42dbe12f6b8d3f2ffbac1bb6729552dd170b23dc Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Wed, 15 Aug 2018 16:00:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=A4=B1=E8=B4=A5=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/BookModel.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/BookModel.go b/models/BookModel.go index 74d61e35..1ca0faf8 100644 --- a/models/BookModel.go +++ b/models/BookModel.go @@ -372,7 +372,7 @@ func (book *Book) ThoroughDeleteBook(id int) error { 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 { o.Rollback() return err @@ -411,7 +411,9 @@ func (book *Book) ThoroughDeleteBook(id int) error { 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()