feat: sku

This commit is contained in:
2025-02-11 11:14:35 +08:00
parent 0cdf5ee52d
commit 88ee75143e
2 changed files with 32 additions and 4 deletions

View File

@@ -13,13 +13,20 @@ 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: 'api/order')]
//#[Middlewares([
// JwtAuthMiddleware::class,
//])]
#[Middlewares([
JwtAuthMiddleware::class,
])]
class OrderController extends AbstractController
{
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'check_cart',methods: 'post')]
#[Scene(scene: 'check_cart')]
public function checkCart()
@@ -27,6 +34,11 @@ class OrderController extends AbstractController
return (new CheckCartService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'confirmation_order',methods: 'post')]
#[Scene(scene: 'confirmation_order')]
public function confirmationOrder()
@@ -34,6 +46,11 @@ class OrderController extends AbstractController
return (new ConfirmationOrderService)->handle();
}
/**
* @return array
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
#[RequestMapping(path: 'place_order',methods: 'post')]
#[Scene(scene: 'place_order')]
public function placeOrder()

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace App\Service\Api\Good;
use App\Cache\Redis\Api\GoodCache;
use App\Cache\Redis\Api\SiteCache;
use App\Service\Api\BaseService;
use App\Service\ServiceTrait\Common\CycleTrait;
use Hyperf\Di\Annotation\Inject;
@@ -27,6 +28,12 @@ class OptionalListService extends BaseService
#[Inject]
protected GoodCache $goodCache;
/**
* @var SiteCache
*/
#[Inject]
protected SiteCache $siteCache;
/**
* @return array
* @throws ContainerExceptionInterface
@@ -39,7 +46,11 @@ class OptionalListService extends BaseService
if (empty($cycleId)) return ['list' => []];
$this->goodCache->cycleId = (int)$cycleId;
$this->goodCache->kitchenId = (int)$this->request->input('kitchen_id');
$siteInfo = $this->siteCache->getSiteInfo((int)$this->request->input('site_id'));
if (empty($siteInfo) || empty($siteInfo['kitchen_id'])) return ['list' => []];
$this->goodCache->kitchenId = $siteInfo['kitchen_id'];
$data = $this->goodCache->getOptionalGoodList();
return $this->return->success('success', ['list' => $data]);