feat : menu list
This commit is contained in:
@@ -13,6 +13,8 @@ use Hyperf\HttpServer\Annotation\Controller;
|
||||
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||
use Hyperf\Validation\Annotation\Scene;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
#[Controller(prefix: "admin/auth")]
|
||||
#[Middlewares([
|
||||
@@ -20,27 +22,66 @@ use Hyperf\Validation\Annotation\Scene;
|
||||
])]
|
||||
class AuthController extends AbstractController
|
||||
{
|
||||
public function menu_add(AuthRequest $request)
|
||||
/**
|
||||
* 添加菜单
|
||||
* @param AuthRequest $request
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[RequestMapping(path: "menu_add", methods: "POST")]
|
||||
#[Scene(scene: "menu_add")]
|
||||
public function menuAdd(AuthRequest $request)
|
||||
{
|
||||
return (new RoleMenuService)->add();
|
||||
}
|
||||
|
||||
public function menu_edit()
|
||||
/**
|
||||
* 修改菜单
|
||||
* @param AuthRequest $request
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
#[RequestMapping(path: "menu_edit", methods: "POST")]
|
||||
#[Scene(scene: "menu_edit")]
|
||||
public function menuEdit(AuthRequest $request)
|
||||
{
|
||||
return (new RoleMenuService)->edit();
|
||||
}
|
||||
|
||||
public function menu_del()
|
||||
/**
|
||||
* @param AuthRequest $request
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \RedisException
|
||||
*/
|
||||
#[RequestMapping(path: "menu_del", methods: "GET")]
|
||||
#[Scene(scene: "menu_del")]
|
||||
public function menuDel(AuthRequest $request)
|
||||
{
|
||||
return (new RoleMenuService)->del();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \RedisException
|
||||
*/
|
||||
#[RequestMapping(path: "menu_list", methods: "GET")]
|
||||
public function menu_list()
|
||||
public function menuList()
|
||||
{
|
||||
return (new RoleMenuService)->handle();
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单详情
|
||||
* @param AuthRequest $request
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "menu", methods: "GET")]
|
||||
#[Scene(scene: "menu_info")]
|
||||
public function menu(AuthRequest $request)
|
||||
@@ -48,6 +89,19 @@ class AuthController extends AbstractController
|
||||
return (new RoleMenuService)->details();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建菜单缓存
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws \RedisException
|
||||
*/
|
||||
#[RequestMapping(path: "menu_build_cache", methods: "GET")]
|
||||
public function buildMenuCache()
|
||||
{
|
||||
return (new RoleMenuService)->buildCache();
|
||||
}
|
||||
|
||||
public function role_add(AuthRequest $request)
|
||||
{
|
||||
return (new RoleService)->add();
|
||||
|
||||
Reference in New Issue
Block a user