Commit fe19baae authored by hujun's avatar hujun

批量修改客方

parent d9a6b376
......@@ -28,10 +28,6 @@ class Member extends Basic{
}
public function index() {
return view('member/users_list');
}
/**
* 用户列表
*
......@@ -324,4 +320,35 @@ class Member extends Basic{
$data = $this->user->delete_user($id);
return $this->response($data['code'], $data['msg'], $data['data']);
}
/**
* 批量修改客方
*
* @return \think\Response
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function batchEditCustomer() {
if (empty($this->params['old_agents_id']) || empty($this->params['agents_id'])) {
return $this->response(101, '经纪人信息错误');
}
$user = new Users();
$user->startTrans();
$user->lock(true);
$user_data = $user->getUserByWhere(['agent_id' => $this->params['old_agents_id']], 'id');
$user_data_arr = [];
foreach ($user_data as $k=>$v) {
$user_data_arr[$k]['id'] = $v['id'];
$user_data_arr[$k]['agent_id'] = $this->params['agents_id'];
}
$total = $user->updateUserAll($user_data_arr);
$user->commit();
return $this->response(200, '', ['total'=>count($total)]);
}
}
......@@ -468,4 +468,13 @@ class Users extends Model
return $data;
}
/**
* @param $data
* @return array|false
* @throws \Exception
*/
public function updateUserAll($data) {
return $this->saveAll($data);
}
}
......@@ -66,6 +66,7 @@ Route::group('index', [
'del_user' => ['index/member/delUser',['method'=>'post']],
'pcAddFollow' => ['index/member/pcAddFollow',['method'=>'post']],
'pcEditClient' => ['index/member/pcEditClient',['method'=>'post | get']],
'batchEditCustomer' => ['index/member/batchEditCustomer',['method'=>'post']], //批量修改客方
//transfer转铺列表
'transfer_list' => ['index/transfer/index', ['method' => 'get']],
......
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