feat : city
This commit is contained in:
81
app/Controller/Admin/CityController.php
Normal file
81
app/Controller/Admin/CityController.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Controller\AbstractController;
|
||||
use App\Middleware\Admin\JwtAuthMiddleware;
|
||||
use App\Request\Admin\CityRequest;
|
||||
use App\Service\Admin\System\CityService;
|
||||
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/city")]
|
||||
#[Middlewares([
|
||||
JwtAuthMiddleware::class,
|
||||
])]
|
||||
class CityController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @param CityRequest $request
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "add", methods: "POST")]
|
||||
#[Scene(scene: "add")]
|
||||
public function add(CityRequest $request): array
|
||||
{
|
||||
return (new CityService)->add();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws RedisException
|
||||
*/
|
||||
#[RequestMapping(path: "list", methods: "GET")]
|
||||
#[Scene(scene: "list")]
|
||||
public function list(): array
|
||||
{
|
||||
return (new CityService)->handle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "edit", methods: "GET")]
|
||||
#[Scene(scene: "edit")]
|
||||
public function edit(): array
|
||||
{
|
||||
return (new CityService)->changeStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "del", methods: "GET")]
|
||||
#[Scene(scene: "del")]
|
||||
public function delete(): array
|
||||
{
|
||||
return (new CityService)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws RedisException
|
||||
*/
|
||||
#[RequestMapping(path: "info", methods: "GET")]
|
||||
#[Scene(scene: "info")]
|
||||
public function info(): array
|
||||
{
|
||||
return (new CityService)->info();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user