feat:删除项目时删除上传的附件和图片

pull/358/head
lifei6671 2018-08-20 15:11:32 +08:00
parent ef7857e859
commit 100db87c6d
1 changed files with 5 additions and 0 deletions

View File

@ -413,9 +413,14 @@ func (book *Book) ThoroughDeleteBook(id int) error {
NewLabel().InsertOrUpdateMulti(book.Label) NewLabel().InsertOrUpdateMulti(book.Label)
} }
//删除导出缓存
if err := os.RemoveAll(filepath.Join(conf.GetExportOutputPath(), strconv.Itoa(id))); err != nil { if err := os.RemoveAll(filepath.Join(conf.GetExportOutputPath(), strconv.Itoa(id))); err != nil {
beego.Error("删除项目缓存失败 ->",err) beego.Error("删除项目缓存失败 ->",err)
} }
//删除附件和图片
if err := os.RemoveAll(filepath.Join(conf.WorkingDirectory,"uploads",book.Identify)); err != nil {
beego.Error("删除项目附件和图片失败 ->",err)
}
return o.Commit() return o.Commit()