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