作者 liyuhang

gx

@@ -61,12 +61,13 @@ class UserLogic extends BaseLogic @@ -61,12 +61,13 @@ class UserLogic extends BaseLogic
61 //上传图片 61 //上传图片
62 if(isset($this->param['image'])){ 62 if(isset($this->param['image'])){
63 //查看当前用户是否已有头像 63 //查看当前用户是否已有头像
64 - $info = $this->model->read(['id'=>$this->param['id']],['id','hash']);  
65 - if($info !== false && !empty($info['hash'])){ 64 + $info = $this->model->read(['id'=>$this->param['id']],['id','image']);
  65 + if($info !== false && !empty($info['image'])){
66 //TODO::删除资源 66 //TODO::删除资源
67 $imageModel = new Image(); 67 $imageModel = new Image();
68 $image_info = $imageModel->read(['hash'=>$info['hash']],['id','path']); 68 $image_info = $imageModel->read(['hash'=>$info['hash']],['id','path']);
69 shell_exec('rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['hash'] . '*'); 69 shell_exec('rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['hash'] . '*');
  70 + $imageModel->del(['hash'=>$info['image']]);
70 } 71 }
71 $this->param['image'] = $this->upload(); 72 $this->param['image'] = $this->upload();
72 $this->model->edits($this->param); 73 $this->model->edits($this->param);