59 lines
1.4 KiB
PHP
59 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Admin;
|
|
|
|
use App\Controller\AbstractController;
|
|
use App\Middleware\Admin\JwtAuthMiddleware;
|
|
use App\Service\Admin\Good\PurchaseService;
|
|
use Exception;
|
|
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/purchase')]
|
|
#[Middlewares([
|
|
JwtAuthMiddleware::class,
|
|
])]
|
|
class PurchaseController extends AbstractController
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: "add", methods: "POST")]
|
|
#[Scene(scene: "add")]
|
|
public function add()
|
|
{
|
|
return (new PurchaseService)->add();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: "del", methods: "GET")]
|
|
#[Scene(scene: "del")]
|
|
public function del()
|
|
{
|
|
return (new PurchaseService)->del();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
#[RequestMapping(path: "list", methods: "GET")]
|
|
#[Scene(scene: "list")]
|
|
public function list(): array
|
|
{
|
|
return (new PurchaseService)->handle();
|
|
}
|
|
}
|