|
|
|
@ -402,6 +402,23 @@ class User extends BaseController |
|
|
|
|
return app('json')->success(formToData($this->repository->changeGroupForm($id))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function changeAgent($id){ |
|
|
|
|
$agent_district_id = (int)$this->request->param('agent_district_id', 0); |
|
|
|
|
$agent_district = $this->request->param('agent_district'); |
|
|
|
|
if (!$this->repository->exists($id)) |
|
|
|
|
return app('json')->fail('数据不存在'); |
|
|
|
|
$where = array(); |
|
|
|
|
$where[] = array('agent_district_id' , '=', $agent_district_id); |
|
|
|
|
$where[] = array('uid' , '<>', $id); |
|
|
|
|
$exist = $this->repository->getWhere($where); |
|
|
|
|
if($exist){ |
|
|
|
|
return app('json')->fail('该代理已存在'); |
|
|
|
|
} |
|
|
|
|
$this->repository->update($id, array('agent_district_id' => $agent_district_id, 'agent_district' => $agent_district)); |
|
|
|
|
return \app('json')->success('修改成功'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param $id |
|
|
|
|
* @return mixed |
|
|
|
|