Commit 75772249 authored by hujun's avatar hujun

编辑经纪人更换手机号处理

parent 031d9cc9
...@@ -125,15 +125,11 @@ class Agent extends Basic ...@@ -125,15 +125,11 @@ class Agent extends Basic
return $this->response(101, '门店id为空!'); return $this->response(101, '门店id为空!');
} }
$password = $m_agent->verifyUser('password', '', ['phone'=> $this->params['phone']]); $num = 0; //判断重复手机号
//新增或者编辑数据 //新增或者编辑数据
if(empty($this->params['id'])) { if(empty($this->params['id'])) {
$num = $m_agent->getListDistrictTotal(['phone'=> $this->params['phone']]);
//判断name是否重复
if(!empty($password)) {
return $this->response(101, '手机号重复');
}
$data['create_time'] = date( 'Y-m-d H:i:s',time()); $data['create_time'] = date( 'Y-m-d H:i:s',time());
$data['update_time'] = date( 'Y-m-d H:i:s',time()); $data['update_time'] = date( 'Y-m-d H:i:s',time());
...@@ -141,16 +137,26 @@ class Agent extends Basic ...@@ -141,16 +137,26 @@ class Agent extends Basic
$data['password'] = md5(substr($this->params['phone'], -6)); //默认号码后6位 $data['password'] = md5(substr($this->params['phone'], -6)); //默认号码后6位
$data['auth_group_id'] = 5; $data['auth_group_id'] = 5;
} else { } else {
$agent_data = $m_agent->verifyUser('phone,password', '', ['id'=> $this->params['id']]);
if ($agent_data['phone'] != $this->params['phone']) {
$num = $m_agent->getListDistrictTotal(['phone'=>$this->params['phone']]);
}
$data['update_time'] = date( 'Y-m-d H:i:s',time()); $data['update_time'] = date( 'Y-m-d H:i:s',time());
if (!empty($this->params['password'])) { if (!empty($this->params['password']) && !empty($agent_data['password'])) {
$md5_password = md5($this->params['password']); $md5_password = md5($this->params['password']);
if (($md5_password != $password['password']) && ($password['password'] != $this->params['password'])) { if (($md5_password != $agent_data['password']) && ($agent_data['password'] != $this->params['password'])) {
$data['password'] = $md5_password; $data['password'] = $md5_password;
} }
} }
} }
if($num > 0) {
return $this->response(101, '手机号重复');
}
$store = new AStore(); $store = new AStore();
$data['district_id'] = $store->getStoreKeyById('district_id', ['id'=>$this->params['store_id']]); $data['district_id'] = $store->getStoreKeyById('district_id', ['id'=>$this->params['store_id']]);
......
...@@ -30,6 +30,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin ...@@ -30,6 +30,7 @@ define(['doT', 'text!temp/agent_template_tpl.html', 'css!style/home.css', 'pagin
$(".form-horizontal")[0].reset(); //重置表单 $(".form-horizontal")[0].reset(); //重置表单
agent.agent_id = $(this).attr("data-id"); agent.agent_id = $(this).attr("data-id");
$("#password").parent().removeClass('hide'); //编辑显示密码 $("#password").parent().removeClass('hide'); //编辑显示密码
$("#password").attr('type','text');
agent.Edit(); agent.Edit();
}); });
......
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