Files
hyperf_service/app/Controller/Api/GoodController.php
2025-03-20 16:29:59 +08:00

49 lines
1.3 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\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();
}
}