diff --git a/application/admin/controller/User.php b/application/admin/controller/User.php index 83008b5..c86b5e4 100644 --- a/application/admin/controller/User.php +++ b/application/admin/controller/User.php @@ -162,6 +162,18 @@ class User extends Base { */ public function changeStatus() { $id = $this->request->get('id'); + + $isSupper = Tools::isAdministrator($id); + if ($isSupper && $this->userInfo['id']>1) { + $header = config('apiAdmin.CROSS_DOMAIN'); + $data = ['code' => ReturnCode::INVALID, 'msg' => '非常抱歉,不能修改管理员状态!', 'data' => []]; + return json($data, 200, $header); + } + + if($id<2){ + return $this->buildFailed(ReturnCode::DELETE_FAILED, '非常抱歉,不能修改超级管理员状态!'); + } + $status = $this->request->get('status'); $res = AdminUser::update([ 'id' => $id, @@ -192,6 +204,14 @@ class User extends Base { if ($postData['groupId']) { $groups = trim(implode(',', $postData['groupId']), ','); } + + $isSupper = Tools::isAdministrator($postData['id']); + if ($isSupper && $this->userInfo['id']>1) { + $header = config('apiAdmin.CROSS_DOMAIN'); + $data = ['code' => ReturnCode::INVALID, 'msg' => '非常抱歉,只有超级管理员才能修改管理员信息!', 'data' => []]; + return json($data, 200, $header); + } + $postData['updateTime'] = time(); unset($postData['groupId']); $res = AdminUser::update($postData); @@ -259,6 +279,17 @@ class User extends Base { */ public function del() { $id = $this->request->get('id'); + + $isSupper = Tools::isAdministrator($id); + if ($isSupper && $this->userInfo['id']>1) { + $header = config('apiAdmin.CROSS_DOMAIN'); + $data = ['code' => ReturnCode::INVALID, 'msg' => '非常抱歉,只有超级管理员才能删除管理员!', 'data' => []]; + return json($data, 200, $header); + } + if($id<2){ + return $this->buildFailed(ReturnCode::DELETE_FAILED, '超级管理员不能被删除!'); + } + if (!$id) { return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数'); } diff --git a/application/wiki/view/index/detail.html b/application/wiki/view/index/detail.html index 5ab0c63..c86f736 100644 --- a/application/wiki/view/index/detail.html +++ b/application/wiki/view/index/detail.html @@ -12,6 +12,18 @@
+
+

{:config('apiAdmin.APP_NAME')} - 接口文档

+ + + + + + + + + +