61 lines
1.6 KiB
PHP
61 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Api;
|
|
|
|
use App\Controller\AbstractController;
|
|
use App\Service\Api\Good\AddStapleFoodInfoService;
|
|
use App\Service\Api\Good\MealListService;
|
|
use App\Service\Api\Good\OptionalInfoService;
|
|
use App\Service\Api\Good\OptionalListService;
|
|
use Hyperf\HttpServer\Annotation\Controller;
|
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
#[Controller(prefix: 'api/good')]
|
|
class GoodController extends AbstractController
|
|
{
|
|
/**
|
|
* @return array[]
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: 'optional',methods: 'GET')]
|
|
public function optional(): array
|
|
{
|
|
return (new OptionalListService)->handle();
|
|
}
|
|
|
|
/**
|
|
* @return array[]
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: 'meal',methods: 'GET')]
|
|
public function meal(): array
|
|
{
|
|
return (new MealListService)->handle();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: 'add_staple_food',methods: 'GET')]
|
|
public function add_staple_food()
|
|
{
|
|
return (new AddStapleFoodInfoService)->handle();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
#[RequestMapping(path: 'optional_info',methods: 'GET')]
|
|
public function optionalInfo()
|
|
{
|
|
return (new OptionalInfoService)->handle();
|
|
}
|
|
} |