Commit 6d653a59 authored by zhuwei's avatar zhuwei

经纪人修改密码

parent 9370ad6d
...@@ -1126,4 +1126,25 @@ class Broker extends Basic ...@@ -1126,4 +1126,25 @@ class Broker extends Basic
return $this->response(200,'', []); return $this->response(200,'', []);
} }
/**
* 经纪人修改密码
* @return \think\Response
*/
public function modifyAgentPassword()
{
$params = $this->params;
$checkResult = $this->validate($params, "VerifyValidate.modifyAgentPassword");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$broker_service = new BrokerService();
$result = $broker_service->modifyAgentPassword(
$params['agent_id'],$params['old_password'], $params['new_password'],$params['confirm_password']);
return $this->response($result['status'],$result['msg'], []);
}
} }
\ No newline at end of file
...@@ -494,4 +494,33 @@ class BrokerService ...@@ -494,4 +494,33 @@ class BrokerService
return $m_evaluate->updateData(['agents_id'=>$agent_id], ['agents_id'=>$change_old_id]); return $m_evaluate->updateData(['agents_id'=>$agent_id], ['agents_id'=>$change_old_id]);
} }
/**
* 经纪人修改密码
* @param $agent_id
* @param $old_password
* @param $new_password
* @param $confirm_password
* @return array
*/
public function modifyAgentPassword($agent_id,$old_password,$new_password,$confirm_password){
if ($new_password != $confirm_password)
return ['status'=>101,'msg'=>'请输入相同的新密码'];
if ($old_password == $new_password)
return ['status'=>101,'msg'=>'新密码不能和旧密码相同'];
if (strlen($new_password) < 6 || strlen($new_password) >18 )
return ['status'=>101,'msg'=>'请输入新密码长度为6~18'];
$agent_password = $this->m_agent->getAgentFieldById($agent_id, 'password');
//验证原密码
if($agent_password && (md5($old_password) != $agent_password))
return array('status'=>101,'msg'=>'原密不正确','result'=>'');
$result = $this->m_agent->modifyAgentPassword($agent_id, md5($old_password));
if(!$result)
return array('status'=>101,'msg'=>'修改失败','result'=>'');
return array('status'=>101,'msg'=>'修改成功','result'=>'');
}
} }
\ No newline at end of file
...@@ -17,6 +17,10 @@ class VerifyValidate extends Validate ...@@ -17,6 +17,10 @@ class VerifyValidate extends Validate
'agent_id' => 'require|number', 'agent_id' => 'require|number',
'is_forbidden' => 'require|in:0,1', 'is_forbidden' => 'require|in:0,1',
'operator_id' => 'require|number', 'operator_id' => 'require|number',
'old_password' => 'require',
'new_password' => 'require',
'confirm_password' => 'require',
]; ];
protected $message = [ protected $message = [
...@@ -28,10 +32,14 @@ class VerifyValidate extends Validate ...@@ -28,10 +32,14 @@ class VerifyValidate extends Validate
'operator_id.require' => '操作人为必填字段', 'operator_id.require' => '操作人为必填字段',
'operator_id.number' => '操作人编号只能为数字', 'operator_id.number' => '操作人编号只能为数字',
'old_password.require' => '旧密码不能为空',
'new_password.require' => '新密码不能为空',
'confirm_password.require' => '验证新秘密不能为空',
]; ];
protected $scene = [ protected $scene = [
'select' => [ 'id' ], 'select' => [ 'id' ],
'verifyIsForbidden' => [ 'agent_id', 'is_forbidden', 'operator_id', 'id' ], 'verifyIsForbidden' => [ 'agent_id', 'is_forbidden', 'operator_id', 'id' ],
'modifyAgentPassword' => [ 'agent_id', 'old_password', 'new_password', 'confirm_password' ],
]; ];
} }
\ No newline at end of file
...@@ -1675,4 +1675,12 @@ class AAgents extends BaseModel ...@@ -1675,4 +1675,12 @@ class AAgents extends BaseModel
return $result; return $result;
} }
public function modifyAgentPassword($id, $pwd)
{
$result = $this->save([ 'password' => md5($pwd) ], [ 'id' => $id ]);
return $result;
}
} }
\ No newline at end of file
...@@ -119,6 +119,9 @@ Route::group('index', [ ...@@ -119,6 +119,9 @@ Route::group('index', [
'getAgentGroupSite' => ['index/broker/getAgentGroupSite', ['method' => 'GET']], //获得经纪人站点 'getAgentGroupSite' => ['index/broker/getAgentGroupSite', ['method' => 'GET']], //获得经纪人站点
'agentPositionList' => ['index/broker/agentPositionList', ['method' => 'GET']], //经纪人职称列表 'agentPositionList' => ['index/broker/agentPositionList', ['method' => 'GET']], //经纪人职称列表
'getPerformanceRecordList' => ['index/broker/getPerformanceRecordList', ['method' => 'GET']], //业绩调整记录 'getPerformanceRecordList' => ['index/broker/getPerformanceRecordList', ['method' => 'GET']], //业绩调整记录
'modifyAgentPassword' => ['index/broker/modifyAgentPassword', ['method' => 'GET']], //业绩调整记录
'batchChangDish' => ['index/houses/batchChangDish', ['method' => 'post']],//批量修改盘方 'batchChangDish' => ['index/houses/batchChangDish', ['method' => 'post']],//批量修改盘方
'transformLandlord' => ['index/houses/transformLandlord', ['method' => 'post']],//转换房东手机号 'transformLandlord' => ['index/houses/transformLandlord', ['method' => 'post']],//转换房东手机号
'lockHouse' => ['index/houses/lockHouse', ['method' => 'post']],//锁盘 'lockHouse' => ['index/houses/lockHouse', ['method' => 'post']],//锁盘
......
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