Files
全栈小学生 0bc687481f up
2025-06-20 09:24:40 +08:00

123 lines
3.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\auth;
use app\service\admin\auth\AuthService;
use app\service\admin\auth\AuthSiteService;
use core\base\BaseAdminController;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
* 用户管理
* Class Auth
* @description 用户管理
* @package app\adminapi\controller\auth
*/
class Auth extends BaseAdminController
{
/**
* 登录用户菜单列表的接口
* @description 登录用户菜单列表
*/
public function authMenuList()
{
$data = $this->request->params([
[ 'addon', 'all' ],
]);
return success(( new AuthService() )->getAuthMenuList(1, $data[ 'addon' ]));
}
/**
* 获取当前站点支持的应用
* @description 获取当前站点支持的应用
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getAuthAddonList()
{
return success(( new AuthSiteService() )->getAuthAddonList());
}
/**
* 获取登录用户信息
* @description 获取登录用户信息
* @return Response
*/
public function get()
{
return success(( new AuthService() )->getAuthInfo());
}
/**
* 修改登录用户信息
* @description 修改登录用户信息
* @param $field
* @return Response
*/
public function modify($field)
{
$data = $this->request->params([
[ 'value', '' ],
[ 'field', $field ]
]);
// $this->validate($data, 'app\validate\sys\User.modify');
( new AuthService() )->modifyAuth($field, $data[ 'value' ]);
return success('MODIFY_SUCCESS');
}
/**
* 更新用户
* @description 更新用户
*/
public function edit()
{
$data = $this->request->params([
[ 'real_name', '' ],
[ 'head_img', '' ],
[ 'password', '' ],
[ 'original_password', '' ]
]);
( new AuthService() )->editAuth($data);
return success('MODIFY_SUCCESS');
}
/**
* 获取当前登录站点信息
* @description 获取当前登录站点信息
* @return Response
*/
public function site()
{
return success(( new AuthSiteService() )->getSiteInfo());
}
/**
* 选择可以选择的页面
* @description 选择可以选择的页面
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getShowMenuList()
{
return success(( new AuthSiteService() )->getShowMenuList());
}
}