mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 禁止管理员被禁用
This commit is contained in:
parent
1ad68affed
commit
88040572b9
@ -145,13 +145,17 @@ class User extends Base {
|
||||
public function close(){
|
||||
if( $this->request->isPut() ){
|
||||
$id = $this->request->put($this->primaryKey);
|
||||
$userObj = \app\admin\model\User::get([$this->primaryKey => $id]);
|
||||
if( is_null($userObj) ){
|
||||
$this->error('用户不存在','');
|
||||
if(!isAdministrator($id)){
|
||||
$userObj = \app\admin\model\User::get([$this->primaryKey => $id]);
|
||||
if( is_null($userObj) ){
|
||||
$this->error('用户不存在','');
|
||||
}else{
|
||||
$userObj->status = 0;
|
||||
$userObj->save();
|
||||
$this->success('操作成功', url('User/index'));
|
||||
}
|
||||
}else{
|
||||
$userObj->status = 0;
|
||||
$userObj->save();
|
||||
$this->success('操作成功', url('User/index'));
|
||||
$this->error('管理员不能被禁用','');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user