Commit 40a5f5e9 authored by hujun's avatar hujun

删除方法saveAgent

parent 16f0557a
......@@ -468,84 +468,10 @@ class Broker extends Basic
/**
* 新增or修改or查看
* $group_id !=0为查看
* post存在id为新增
*
* @return \think\Response
*/
public function saveAgent()
{
$m_agent = new AAgents();
$id = $this->params['id'];
if ($this->request->isPost()) {
if (empty($this->params['store_id'])) {
return $this->response(101, '门店id为空!');
}
if (empty($this->params['district_id'])) {
return $this->response(101, '部门id为空!');
}
$num = 0; //判断重复手机号
//新增或者编辑数据
if (empty($this->params['id'])) {
$num = $m_agent->getListDistrictTotal([ 'phone' => $this->params['phone'] ]);
$data['create_time'] = date('Y-m-d H:i:s', time());
$data['update_time'] = date('Y-m-d H:i:s', time());
$id = 0;
$data['password'] = md5(substr($this->params['phone'], -6)); //默认号码后6位
$data['auth_group_id'] = 5;
} 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());
if (!empty($this->params['password']) && !empty($agent_data['password'])) {
$md5_password = md5($this->params['password']);
if (($md5_password != $agent_data['password']) && ($agent_data['password'] != $this->params['password'])) {
$data['password'] = $md5_password;
}
}
}
if ($num > 0) {
return $this->response(101, '手机号重复');
}
$data['district_id'] = $this->params['district_id'];
$data['name'] = trim($this->params['name']);
$data['store_id'] = $this->params['store_id'];
$data['phone'] = trim($this->params['phone']);
$data['admin_off'] = $this->params['admin_off'];
$data['sex'] = $this->params['sex'];
$data['remarks'] = $this->params['remarks'];
if ($m_agent->editData($data, $id)) {
return $this->response(200, '成功');
} else {
return $this->response(101, '无修改');
}
} else {
//查看
$info = $m_agent->verifyUser('id,name,phone,password,district_id,store_id,sex,admin_off,remarks', '', [ 'id' => $id ]);
return $this->response(200, '查看', $info);
}
}
/**
* 新增or修改or查看
*
* @return \think\Response
*/
public function saveAgentV2() {
public function saveAgent() {
$result['code'] = 200;
$result['msg'] = "";
$result['data'] = [];
......
......@@ -168,7 +168,7 @@ Route::group('index', [
'agent' => ['index/broker/agent', ['method' => 'get']], //首页列表界面
'saveAgentIndex' => ['index/broker/saveAgentIndex', ['method' => 'get']], //编辑列表列表界面
'AgentList' => ['index/broker/AgentList', ['method' => 'get']], //首页列表【接口】
'saveAgent' => ['index/broker/saveAgentV2', ['method' => 'get|post']], //修改经纪人【接口】
'saveAgent' => ['index/broker/saveAgent', ['method' => 'get|post']], //修改经纪人【接口】
'updatePhone' => ['index/broker/updatePhone', ['method' => 'post']], //修改手机号
'updateStatus' => ['index/broker/updateStatusV2', ['method' => 'post']], //状态修改【接口】
'updatePosition' => ['index/broker/updatePosition', ['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