作者 lyh

gx

@@ -96,15 +96,6 @@ class NewsLogic extends BaseLogic @@ -96,15 +96,6 @@ class NewsLogic extends BaseLogic
96 try { 96 try {
97 //上传图片 97 //上传图片
98 if(isset($this->param['image']) && is_file($this->param['image'])){ 98 if(isset($this->param['image']) && is_file($this->param['image'])){
99 - //查看当前用户是否已有头像  
100 - if($info !== false && !empty($info['image'])){  
101 - //TODO::删除资源  
102 - $imageModel = new Image();  
103 - $image_info = $imageModel->read(['hash'=>$info['image']],['id','path']);  
104 - shell_exec('rm -rf '.$image_info['path'] . ' ./../uploads/images/cache_'. $info['image'] . '*');  
105 - //清空数据库  
106 - $imageModel->del(['hash'=>$info['image']]);  
107 - }  
108 $this->param['image'] = $this->upload(); 99 $this->param['image'] = $this->upload();
109 } 100 }
110 //设置路由 101 //设置路由
@@ -70,18 +70,9 @@ class UserLogic extends BaseLogic @@ -70,18 +70,9 @@ class UserLogic extends BaseLogic
70 try { 70 try {
71 //上传图片 71 //上传图片
72 if(isset($this->param['image']) && is_file($this->param['image'])){ 72 if(isset($this->param['image']) && is_file($this->param['image'])){
73 - //查看当前用户是否已有头像  
74 - $info = $this->model->read(['id'=>$this->param['id']],['id','image']);  
75 - if($info !== false && !empty($info['image'])){  
76 - //TODO::删除资源  
77 - $imageModel = new Image();  
78 - $image_info = $imageModel->read(['hash'=>$info['image']],['id','path']);  
79 - shell_exec('rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['image'] . '*');  
80 - $imageModel->del(['hash'=>$info['image']]);  
81 - }  
82 $this->param['image'] = $this->upload(); 73 $this->param['image'] = $this->upload();
83 - $this->model->edits($this->param);  
84 } 74 }
  75 + $this->model->edits($this->param);
85 }catch (\exception $e){ 76 }catch (\exception $e){
86 $this->fail('参数错误或其他服务器原因,编辑失败'); 77 $this->fail('参数错误或其他服务器原因,编辑失败');
87 } 78 }