Fix the rename image cache unavailable bug.

This commit is contained in:
zicla 2018-12-18 01:29:47 +08:00
parent 4331fc2661
commit 2d650aca2f

View File

@ -14,6 +14,7 @@ type MatterController struct {
matterDao *MatterDao matterDao *MatterDao
matterService *MatterService matterService *MatterService
downloadTokenDao *DownloadTokenDao downloadTokenDao *DownloadTokenDao
imageCacheDao *ImageCacheDao
} }
//初始化方法 //初始化方法
@ -36,6 +37,11 @@ func (this *MatterController) Init() {
this.downloadTokenDao = b this.downloadTokenDao = b
} }
b = CONTEXT.GetBean(this.imageCacheDao)
if b, ok := b.(*ImageCacheDao); ok {
this.imageCacheDao = b
}
} }
//注册自己的路由。 //注册自己的路由。
@ -430,6 +436,11 @@ func (this *MatterController) Rename(writer http.ResponseWriter, request *http.R
matter.Name = name matter.Name = name
matter = this.matterDao.Save(matter) matter = this.matterDao.Save(matter)
//删除对应的缓存图片。
if !matter.Dir {
this.imageCacheDao.DeleteByMatterUuid(matter.Uuid)
}
return this.Success(matter) return this.Success(matter)
} }