47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Api\Good;
|
|
|
|
use App\Cache\Redis\Api\GoodCache;
|
|
use App\Service\Api\BaseService;
|
|
use App\Service\ServiceTrait\Common\CycleTrait;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
class MealListService extends BaseService
|
|
{
|
|
use CycleTrait;
|
|
|
|
/**
|
|
* @var GoodCache
|
|
*/
|
|
#[Inject]
|
|
protected GoodCache $goodCache;
|
|
|
|
/**
|
|
* @return array|array[]
|
|
* @throws ContainerExceptionInterface
|
|
* @throws NotFoundExceptionInterface
|
|
*/
|
|
public function handle(): array
|
|
{
|
|
$cycleId = $this->initTodayCycleId();
|
|
|
|
if (empty($cycleId)) return ['list' => []];
|
|
|
|
$this->goodCache->cycleId = (int)$cycleId;
|
|
$this->goodCache->kitchenId = (int)$this->request->input('kitchen_id');
|
|
$data = $this->goodCache->getMealGoodList();
|
|
|
|
return $this->return->success('success', ['list' => $data]);
|
|
}
|
|
} |