diff --git a/app/agent/controller/Agent.php b/app/agent/controller/Agent.php index a14557d..ce09d4d 100644 --- a/app/agent/controller/Agent.php +++ b/app/agent/controller/Agent.php @@ -242,15 +242,18 @@ class Agent extends Controller public function updateAgent() { $data = json_decode(file_get_contents("php://input"), true); - $data['password'] = cToMd5($data['password']); + $agent_user_model = new AgentUser; $update_data = [ - 'password'=>cToMd5($data['password']), 'phone'=>$data['phone'], 'qq'=>$data['qq'], 'realname'=>$data['realname'], ]; + if(!empty($data['password'])){ + $data['password'] = cToMd5($data['password']); + $update_data['password'] = $data['password']; + } $agent_user_model->updateOne(['id'=>$data['id']],$update_data);