Commit 0432f038 authored by hujun's avatar hujun

userId to agentId

parent d172d52b
......@@ -326,9 +326,8 @@ class Broker extends Basic
$info = $file->validate(['size'=>512000,'ext'=>'jpg,png']) //限制500KB
->move($path);
if($info){
if ($this->userId) {
$user = new AAgents();
$user_data = $user->field('img')->where('id',$this->userId)->find();
$user_data = $user->field('img')->where('id',$this->agentId)->find();
@unlink($path.DS.$user_data->img); //删除原来的图片
$img_path = $info->getSaveName(); //生成的图片路径
//更新用户信息
......@@ -342,8 +341,6 @@ class Broker extends Basic
$data['status'] = 200;
$data['msg'] = '上传成功';
$data['data'] = ['file_name' => HEADERIMGURL . $img_path];
}
}else{
// 上传失败获取错误信息
$data['msg'] = $file->getError();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment