作者 lyh

gx

@@ -116,14 +116,14 @@ class ImageController @@ -116,14 +116,14 @@ class ImageController
116 'path' => $url.$filename, 116 'path' => $url.$filename,
117 'created_at' => date('Y-m-d H:i:s',time()), 117 'created_at' => date('Y-m-d H:i:s',time()),
118 'size' => $res->getSize(), 118 'size' => $res->getSize(),
119 - 'hash' => $hash.$filename, 119 + 'hash' => $hash,
120 'type'=>$files->getClientOriginalExtension(), 120 'type'=>$files->getClientOriginalExtension(),
121 ]; 121 ];
122 $rs = $imageModel->add($data); 122 $rs = $imageModel->add($data);
123 if ($rs === false) { 123 if ($rs === false) {
124 return $this->response('添加失败', Code::USER_ERROR); 124 return $this->response('添加失败', Code::USER_ERROR);
125 } 125 }
126 - return $hash.$filename; 126 + return $hash;
127 } 127 }
128 /** 128 /**
129 * 生成缩略图缓存 129 * 生成缩略图缓存
@@ -162,10 +162,10 @@ class ImageController @@ -162,10 +162,10 @@ class ImageController
162 'path' => $url.$filename, 162 'path' => $url.$filename,
163 'created_at' => date('Y-m-d H:i:s',time()), 163 'created_at' => date('Y-m-d H:i:s',time()),
164 'size' => $res->getSize(), 164 'size' => $res->getSize(),
165 - 'hash' => $hash.$filename, 165 + 'hash' => $hash,
166 'type'=>$files->getClientOriginalExtension(), 166 'type'=>$files->getClientOriginalExtension(),
167 ]; 167 ];
168 - $data[] = $hash.$filename; 168 + $data[] = $hash;
169 } 169 }
170 $imageModel = new ImageModel(); 170 $imageModel = new ImageModel();
171 $imageModel->insert($save_data); 171 $imageModel->insert($save_data);
@@ -61,8 +61,6 @@ class WebSettingServiceLogic extends BaseLogic @@ -61,8 +61,6 @@ class WebSettingServiceLogic extends BaseLogic
61 $info = $image->read(['hash'=>$this->param['hash']]); 61 $info = $image->read(['hash'=>$this->param['hash']]);
62 if($info !== false){ 62 if($info !== false){
63 $image->del(['id'=>$info['id']]); 63 $image->del(['id'=>$info['id']]);
64 - //删除资源文件  
65 - shell_exec('rm -rf '.$info['path']);  
66 } 64 }
67 DB::commit(); 65 DB::commit();
68 }catch (\Exception $e){ 66 }catch (\Exception $e){