|
@@ -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
|
}
|