|
|
@@ -18,7 +18,6 @@ class UserController extends AdminController
|
|
|
$name = request()->input('name','');//获取搜索名称
|
|
|
$phone = request()->input('phone','');//获取搜索手机号
|
|
|
$status = request()->input('status',0);//获取状态
|
|
|
- $roles_id = request()->input('roles_id','');//获取角色id
|
|
|
$start = request()->input('start','');//获取开始时间
|
|
|
$end = request()->input('end','');//获取结束时间
|
|
|
|
|
|
@@ -27,14 +26,13 @@ class UserController extends AdminController
|
|
|
if ($name) $where[] = ['name', 'like', "%$name%"];
|
|
|
if ($phone) $where[] = ['phone', 'like', "%$phone%"];
|
|
|
if(in_array($status,[1,2])) $where[] = ['status','=',$status];
|
|
|
- if ($roles_id) $where[] = ['roles_id', '=', $roles_id];
|
|
|
if ($start) $where[] = ['created_at', '>=', $start];
|
|
|
if ($end) $where[] = ['created_at', '<=', $end];
|
|
|
|
|
|
//获取数据
|
|
|
$list = User::where($where)
|
|
|
->orderBy('id','desc')
|
|
|
- ->select(['id','name','phone','status','roles_id','created_at'])
|
|
|
+ ->select(['id','name','phone','status','created_at'])
|
|
|
->paginate(10);
|
|
|
|
|
|
return $this->apiResponseSuccess('获取信息成功', [
|
|
|
@@ -55,7 +53,7 @@ class UserController extends AdminController
|
|
|
|
|
|
//查询数据
|
|
|
$where = [['id', $id], ['is_del',0]];
|
|
|
- $info = User::where($where)->select(['id', 'name', 'phone', 'roles_id', 'status'])->first();
|
|
|
+ $info = User::where($where)->select(['id', 'name', 'phone', 'status'])->first();
|
|
|
|
|
|
if (empty($info)) return $this->apiResponseError('没有找到该记录');
|
|
|
|
|
|
@@ -70,7 +68,6 @@ class UserController extends AdminController
|
|
|
$id = request()->input('id', '');//记录id,更新时必须
|
|
|
$phone = request()->input('phone', '');//登录手机号
|
|
|
$name = request()->input('name', '');//姓名
|
|
|
- $roles_id = request()->input('roles_id', 0);//角色id
|
|
|
$password = request()->input('password', '');//密码
|
|
|
$again_password = request()->input('again_password', '');//确认密码
|
|
|
if (empty($phone)) return $this->apiResponseError( '登录手机号必填');
|
|
|
@@ -78,9 +75,6 @@ class UserController extends AdminController
|
|
|
if(!CommonServer::creatServer()->verifyPhoneNumber($phone)){
|
|
|
return $this->apiResponseError( '手机号不正确');
|
|
|
}
|
|
|
- if ($roles_id < 0 ) {
|
|
|
- return $this->apiResponseError( '请选择角色');
|
|
|
- }
|
|
|
|
|
|
if(empty($id)){
|
|
|
if (empty($password) || empty($again_password)) {
|
|
|
@@ -105,7 +99,6 @@ class UserController extends AdminController
|
|
|
'name' => $name,
|
|
|
'phone' => $phone,
|
|
|
'password' => $new_pass['password'],
|
|
|
- 'roles_id' => $roles_id,
|
|
|
'encrypt' => $new_pass['encrypt']
|
|
|
]);
|
|
|
}else{
|
|
|
@@ -140,7 +133,6 @@ class UserController extends AdminController
|
|
|
|
|
|
$update['phone'] = $phone;
|
|
|
$update['name'] = $name;
|
|
|
- $update['roles_id'] = $roles_id;
|
|
|
$res = $info->update($update);
|
|
|
}
|
|
|
|
|
|
@@ -157,7 +149,7 @@ class UserController extends AdminController
|
|
|
*/
|
|
|
function setStatus(){
|
|
|
$id = request()->input('id','');//记录id
|
|
|
- $status = request()->input('status', 0);//是否显示
|
|
|
+ $status = request()->input('status', 0);//状态 1启用 2停用
|
|
|
if(empty($id) || !in_array($status,[1,2])){
|
|
|
return $this->apiResponseError('缺少必要参数');
|
|
|
}
|