123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?php
- namespace app\admin\controller\index;
- use app\admin\controller\BaseController;
- use app\admin\model\SystemAdmin;
- use app\admin\server\index\IndexServer;
- class Index extends BaseController
- {
- /**
- * Notes:获取菜单列表
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/16
- */
- public function getAdminList()
- {
- $keywords = $this->request->get('keywords');
- [$page, $limit] = $this->getPage();
- $result = IndexServer::getAdminList($keywords,$page,$limit);
- return json_success($result, '成功');
- }
- /**
- * Notes:修改管理员
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/16
- */
- public function updateAdmin()
- {
- $admin_id = $this->request->post('admin_id');
- $admin_real_name = $this->request->post('admin_real_name','');
- $admin_pwd = $this->request->post('admin_pwd','');
- $agin_admin_pwd = $this->request->post('agin_admin_pwd','');
- $admin_roles = $this->request->post('admin_roles');
- $admin_status = $this->request->post('admin_status');
- if (!empty($admin_pwd) && !empty($agin_admin_pwd)){
- if ($admin_pwd != $agin_admin_pwd){
- throw new \Exception('两次密码输入不一致!');
- }
- }
- $this->validateCheck('index\IndexValidate', ['admin_id' => $admin_id], 'update');
- $result = IndexServer::updateAdmin($admin_id, $admin_real_name, $admin_pwd, $admin_roles, $admin_status);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:添加管理员
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/16
- */
- public function insertAdmin()
- {
- $admin_real_name = $this->request->post('admin_real_name','');
- $admin_pwd = $this->request->post('admin_pwd','');
- $admin_account = $this->request->post('admin_account');
- $agin_admin_pwd = $this->request->post('agin_admin_pwd','');
- $admin_roles = $this->request->post('admin_roles');
- $admin_status = $this->request->post('admin_status');
- if (!empty($admin_pwd) && !empty($agin_admin_pwd)){
- if ($admin_pwd != $agin_admin_pwd){
- throw new \Exception('两次密码输入不一致!');
- }
- }
- $this->validateCheck('index\IndexValidate', ['admin_real_name' => $admin_real_name, 'admin_pwd' => $admin_pwd, 'admin_account' => $admin_account, 'agin_admin_pwd' => $agin_admin_pwd, 'admin_roles' => $admin_roles, 'admin_status' => $admin_status], 'insert');
- $result = IndexServer::insertAdmin($admin_account, $admin_real_name, $admin_pwd, $admin_roles, $admin_status);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:删除管理员
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/16
- */
- public function delAdmin()
- {
- $admin_id = $this->request->get('admin_id');
- $this->validateCheck('index\IndexValidate', ['admin_id' => $admin_id], 'info');
- $result = IndexServer::delAdmin($admin_id);
- if ($result){
- return json_success($result, '删除成功');
- }else{
- throw new \Exception('删除失败!');
- }
- }
- /**
- * Notes:查询管理员详情
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function adminInfo()
- {
- $admin_id = $this->request->get('admin_id');
- $this->validateCheck('index\IndexValidate', ['admin_id' => $admin_id], 'info');
- $result = IndexServer::adminInfo($admin_id);
- return json_success($result, '成功');
- }
- /**
- * Notes:管理员启用禁用
- * @return \support\Response
- * User: ZQ
- * Date: 2022/9/13
- */
- public function updateStatus()
- {
- $admin_id = $this->request->get('admin_id');
- $admin_status = $this->request->get('admin_status');
- $this->validateCheck('index\IndexValidate', ['admin_id' => $admin_id], 'info');
- $result = IndexServer::updateStatus($admin_id, $admin_status);
- return json_success($result, '修改成功');
- }
- /**
- * Notes:获取小程序页面地址列表
- * @return \support\Response
- * User: yym
- * Date: 2022/10/25
- */
- public function getPageList()
- {
- return json_success(IndexServer::getPageList());
- }
- }
|