feat: sku
This commit is contained in:
@@ -13,13 +13,20 @@ use Hyperf\HttpServer\Annotation\Controller;
|
|||||||
use Hyperf\HttpServer\Annotation\Middlewares;
|
use Hyperf\HttpServer\Annotation\Middlewares;
|
||||||
use Hyperf\HttpServer\Annotation\RequestMapping;
|
use Hyperf\HttpServer\Annotation\RequestMapping;
|
||||||
use Hyperf\Validation\Annotation\Scene;
|
use Hyperf\Validation\Annotation\Scene;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
|
||||||
#[Controller(prefix: 'api/order')]
|
#[Controller(prefix: 'api/order')]
|
||||||
//#[Middlewares([
|
#[Middlewares([
|
||||||
// JwtAuthMiddleware::class,
|
JwtAuthMiddleware::class,
|
||||||
//])]
|
])]
|
||||||
class OrderController extends AbstractController
|
class OrderController extends AbstractController
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
#[RequestMapping(path: 'check_cart',methods: 'post')]
|
#[RequestMapping(path: 'check_cart',methods: 'post')]
|
||||||
#[Scene(scene: 'check_cart')]
|
#[Scene(scene: 'check_cart')]
|
||||||
public function checkCart()
|
public function checkCart()
|
||||||
@@ -27,6 +34,11 @@ class OrderController extends AbstractController
|
|||||||
return (new CheckCartService)->handle();
|
return (new CheckCartService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
#[RequestMapping(path: 'confirmation_order',methods: 'post')]
|
#[RequestMapping(path: 'confirmation_order',methods: 'post')]
|
||||||
#[Scene(scene: 'confirmation_order')]
|
#[Scene(scene: 'confirmation_order')]
|
||||||
public function confirmationOrder()
|
public function confirmationOrder()
|
||||||
@@ -34,6 +46,11 @@ class OrderController extends AbstractController
|
|||||||
return (new ConfirmationOrderService)->handle();
|
return (new ConfirmationOrderService)->handle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
*/
|
||||||
#[RequestMapping(path: 'place_order',methods: 'post')]
|
#[RequestMapping(path: 'place_order',methods: 'post')]
|
||||||
#[Scene(scene: 'place_order')]
|
#[Scene(scene: 'place_order')]
|
||||||
public function placeOrder()
|
public function placeOrder()
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Service\Api\Good;
|
namespace App\Service\Api\Good;
|
||||||
|
|
||||||
use App\Cache\Redis\Api\GoodCache;
|
use App\Cache\Redis\Api\GoodCache;
|
||||||
|
use App\Cache\Redis\Api\SiteCache;
|
||||||
use App\Service\Api\BaseService;
|
use App\Service\Api\BaseService;
|
||||||
use App\Service\ServiceTrait\Common\CycleTrait;
|
use App\Service\ServiceTrait\Common\CycleTrait;
|
||||||
use Hyperf\Di\Annotation\Inject;
|
use Hyperf\Di\Annotation\Inject;
|
||||||
@@ -27,6 +28,12 @@ class OptionalListService extends BaseService
|
|||||||
#[Inject]
|
#[Inject]
|
||||||
protected GoodCache $goodCache;
|
protected GoodCache $goodCache;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var SiteCache
|
||||||
|
*/
|
||||||
|
#[Inject]
|
||||||
|
protected SiteCache $siteCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
* @return array
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
@@ -39,7 +46,11 @@ class OptionalListService extends BaseService
|
|||||||
if (empty($cycleId)) return ['list' => []];
|
if (empty($cycleId)) return ['list' => []];
|
||||||
|
|
||||||
$this->goodCache->cycleId = (int)$cycleId;
|
$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();
|
$data = $this->goodCache->getOptionalGoodList();
|
||||||
|
|
||||||
return $this->return->success('success', ['list' => $data]);
|
return $this->return->success('success', ['list' => $data]);
|
||||||
|
|||||||
Reference in New Issue
Block a user