feat: spu

This commit is contained in:
2025-01-22 11:04:12 +08:00
parent 2beb8d9e55
commit 9b7390129d
10 changed files with 426 additions and 10 deletions

View File

@@ -10,12 +10,38 @@ 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 OptionalListService extends BaseService
{
public function handle()
use CycleTrait;
/**
* @var GoodCache
*/
#[Inject]
protected GoodCache $goodCache;
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function handle(): array
{
//todo Write logic
$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->getOptionalGoodList();
return $this->return->success('success', ['list' => $data]);
}
}