feat : role

This commit is contained in:
2024-10-28 17:56:19 +08:00
parent c86c6c1baf
commit d6465b21d8
12 changed files with 485 additions and 90 deletions

View File

@@ -9,6 +9,7 @@ use App\Middleware\Admin\JwtAuthMiddleware;
use App\Request\Admin\AuthRequest;
use App\Service\Admin\User\RoleMenuService;
use App\Service\Admin\User\RoleService;
use Exception;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middlewares;
use Hyperf\HttpServer\Annotation\RequestMapping;
@@ -102,29 +103,63 @@ class AuthController extends AbstractController
return (new RoleMenuService)->buildCache();
}
/**
* @param AuthRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "role_add", methods: "POST")]
#[Scene(scene: "role_add")]
public function role_add(AuthRequest $request)
{
return (new RoleService)->add();
}
public function role_edit()
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "role_edit", methods: "POST")]
#[Scene(scene: "role_edit")]
public function roleEdit()
{
return (new RoleService)->edit();
}
public function role_status()
/**
* @param AuthRequest $request
* @return array
* @throws Exception
*/
#[RequestMapping(path: "role_change_status", methods: "POST")]
#[Scene(scene: "role_change_status")]
public function roleChangeStatus(AuthRequest $request)
{
return (new RoleService)->changeStatus();
}
public function role_list()
/**
* @return array
*/
#[RequestMapping(path: "role_list", methods: "GET")]
#[Scene(scene: "role_list")]
public function roleList(AuthRequest $request)
{
return (new RoleService)->handle();
}
/**
* @param AuthRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws \RedisException
*/
#[RequestMapping(path: "role", methods: "GET")]
#[Scene(scene: "role_info")]
public function role(AuthRequest $request)
public function role(AuthRequest $request): array
{
return (new RoleService)->details();
}