diff --git a/application/service/ResourcesService.php b/application/service/ResourcesService.php index 4a01d20e0356ecfa25f8c3c4238a4e7d000f210b..c881d13903ed2a52bc8c7c4207e57e0482fc44a5 100755 --- a/application/service/ResourcesService.php +++ b/application/service/ResourcesService.php @@ -425,7 +425,7 @@ class ResourcesService { // 获取附件数据 $where = ['path_type'=>$path_type]; - $data = DB::name('Attachment')->where($where)->column('url'); + $data = DB::name('Attachment')->where($where)->select(); if(!empty($data)) { // 删除数据库数据 @@ -438,13 +438,22 @@ class ResourcesService $path = substr(ROOT_PATH, 0, -1); foreach($data as $v) { - $file = $path.$v; + $file = $path.$v['url']; if(file_exists($file) && is_writable($file)) { \base\FileUtil::UnlinkFile($file); } } } + + // 附件删除成功后处理钩子 + $hook_name = 'plugins_service_attachment_path_type_delete_success'; + Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'data' => $data, + ]); + return DataReturn('删除成功', 0); }