Files
hyperf_service/app/Controller/Admin/SectionController.php
2024-11-07 16:17:57 +08:00

99 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Middleware\Admin\JwtAuthMiddleware;
use App\Request\Admin\SectionRequest;
use App\Service\Admin\User\SectionService;
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;
use RedisException;
#[Controller(prefix: "admin/section")]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class SectionController
{
/**
* @param SectionRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws RedisException
*/
#[RequestMapping(path: "add", methods: "POST")]
#[Scene(scene: "add")]
public function add(SectionRequest $request)
{
return (new SectionService)->add();
}
/**
* @param SectionRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws RedisException
*/
#[RequestMapping(path: "edit", methods: "POST")]
#[Scene(scene: "edit")]
public function edit(SectionRequest $request)
{
return (new SectionService)->edit();
}
/**
* @param SectionRequest $request
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws RedisException
*/
#[RequestMapping(path: "del", methods: "GET")]
#[Scene(scene: "del")]
public function del(SectionRequest $request)
{
return (new SectionService)->del();
}
/**
* @param SectionRequest $request
* @return array
*/
#[RequestMapping(path: "info", methods: "GET")]
#[Scene(scene: "info")]
public function info(SectionRequest $request)
{
return (new SectionService)->info();
}
/**
* @param SectionRequest $request
* @return array
*/
#[RequestMapping(path: "list", methods: "GET")]
#[Scene(scene: "list")]
public function list(SectionRequest $request)
{
return (new SectionService)->handle();
}
/**
* @param SectionRequest $request
* @return array
*/
#[RequestMapping(path: "all_list", methods: "GET")]
#[Scene(scene: "all_list")]
public function allList(SectionRequest $request)
{
return (new SectionService)->handle();
}
}