Files
hyperf_service/app/Controller/Admin/CateringController.php
2025-04-01 11:49:50 +08:00

189 lines
5.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Controller\Admin;
use App\Middleware\Admin\JwtAuthMiddleware;
use App\Service\Admin\Catering\Meal\CheckService;
use App\Service\Admin\Catering\Option\CompleteListService;
use App\Service\Admin\Catering\Option\CompletePrintService;
use App\Service\Admin\Catering\Meal\CycleListService as MealCycleListService;
use App\Service\Admin\Catering\Option\CycleListService as OptionCycleListService;
use App\Service\Admin\Catering\Option\CateringService as OptionCateringService;
use App\Service\Admin\Catering\Meal\CateringService as MealCateringService;
use App\Service\Admin\Catering\Option\PrintService;
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/catering")]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class CateringController
{
/**
* 套餐周期配餐列表
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "meal/cycle_list", methods: "GET")]
#[Scene(scene: "meal_cycle_list")]
public function getMealCycleList()
{
return (new MealCycleListService)->handle();
}
/**
* 自选周期配餐列表
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/cycle_list", methods: "GET")]
#[Scene(scene: "option_cycle_list")]
public function getOptionCycleList()
{
return(new OptionCycleListService)->handle();
}
/**
* 套餐剩余数量
* @return array
*/
#[RequestMapping(path: "meal/remain_count", methods: "GET")]
#[Scene(scene: "meal_remain_count")]
public function remainMealCateringCount()
{
return (new MealCycleListService)->remainCount();
}
/**
* 自选剩余数量
* @return array
*/
#[RequestMapping(path: "option/remain_count", methods: "GET")]
#[Scene(scene: "option_remain_count")]
public function remainOptionCateringCount()
{
return (new OptionCycleListService)->remainCount();
}
/**
* @return array
*/
#[RequestMapping(path: "meal/spu_list", methods: "GET")]
#[Scene(scene: "meal_spu_list")]
public function getMealGoodsList()
{
return (new MealCycleListService)->skuList();
}
/**
* 配餐
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "meal/catering", methods: "GET")]
#[Scene(scene: "meal_catering")]
public function mealCatering()
{
return (new MealCateringService())->handle();
}
/**
* 完成检测
* @return array
*/
#[RequestMapping(path: "meal/catering/finish_check", methods: "GET")]
#[Scene(scene: "meal_catering_finish_check")]
public function mealFinishCheck()
{
return (new CheckService)->handle();
}
/**
* 自选配餐
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/catering", methods: "POST")]
#[Scene(scene: "option_catering")]
public function optionCatering()
{
return (new OptionCateringService)->handle();
}
/**
* 自选是否打印
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/check_is_print", methods: "POST")]
#[Scene(scene: "option_check_is_print")]
public function optionCheckPrint()
{
return (new PrintService)->checkPrint();
}
/**
* 打印机/喷码机列表
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/print_list", methods: "GET")]
#[Scene(scene: "option_print_list")]
public function optionPrintList()
{
return (new PrintService)->handle();
}
/**
* 自选补打印列表
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/complete_list", methods: "GET")]
#[Scene(scene: "option_complete_list")]
public function completeList()
{
return (new CompleteListService)->handle();
}
/**
* 自选补打印
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/complete_print", methods: "GET")]
#[Scene(scene: "option_complete_print")]
public function completePrint()
{
return (new CompletePrintService)->handle();
}
/**
* 取消打印
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: "option/cancel_print", methods: "GET")]
#[Scene(scene: "option_cancel_print")]
public function cancelPrint()
{
return (new PrintService)->cancel();
}
}