diff --git a/app/Controller/PurchaseLimitController.php b/app/Controller/PurchaseLimitController.php index f1b96c7..591ce00 100644 --- a/app/Controller/PurchaseLimitController.php +++ b/app/Controller/PurchaseLimitController.php @@ -35,6 +35,12 @@ class PurchaseLimitController extends BaseController return $this->success($res); } + public function getStoreIdByMarketId() + { + $res = $this->purchaseLimitService->getStoreIdByMarketId($this->request->all()); + return $this->success($res); + } + public function test() { $res = $this->purchaseLimitService->test($this->request->all()); diff --git a/app/Service/PurchaseLimitService.php b/app/Service/PurchaseLimitService.php index a0cc64b..3e0b515 100644 --- a/app/Service/PurchaseLimitService.php +++ b/app/Service/PurchaseLimitService.php @@ -48,7 +48,7 @@ class PurchaseLimitService implements PurchaseLimitServiceInterface $money = $goods->money; } //库存校验 is_max 无限库存 - if($goods->is_max == 2 && ($num + $params['num']) > $inventory) + if($goods->is_max != Goods::INVENTORY_NOLIMIT && ($num + $params['num']) > $inventory) { $error = [ 'error' => '库存不足' @@ -150,7 +150,7 @@ class PurchaseLimitService implements PurchaseLimitServiceInterface $inventory = $goods->inventory; } //库存校验 is_max 无限库存 - if($goods->is_max == 2 && $params['num'] > $inventory) + if($goods->is_max != Goods::INVENTORY_NOLIMIT && $params['num'] > $inventory) { $error = [ 'error' => '库存不足' @@ -168,6 +168,20 @@ class PurchaseLimitService implements PurchaseLimitServiceInterface // } } + public function getStoreIdByMarketId($params) + { + $res = [ + 'id' => 7, + 'item' => 1, + 'item_text' => 'page', + 'logo' => 'http://lanzutest.lanzulive.com/attachment/images/2/2020/08/PY55Y3Mz17yJo17rv1Z7vImX1V5159.jpg', + 'redirect_url' => '/zh_cjdianc/pages/takeout/takeoutindex?store_id=123', + 'src' => '/zh_cjdianc/pages/takeout/takeoutindex?store_id=123', + 'src2' => '/zh_cjdianc/pages/takeout/takeoutindex?store_id=123', + ]; + return $res; + } + public function test($params) { return $params; diff --git a/app/Service/PurchaseLimitServiceInterface.php b/app/Service/PurchaseLimitServiceInterface.php index b460c81..4cbcaf3 100644 --- a/app/Service/PurchaseLimitServiceInterface.php +++ b/app/Service/PurchaseLimitServiceInterface.php @@ -10,5 +10,7 @@ interface PurchaseLimitServiceInterface public function updateShopCar($params); + public function getStoreIdByMarketId($params); + public function test($params); } \ No newline at end of file diff --git a/config/routes.php b/config/routes.php index 254b0f7..6f9ebdd 100644 --- a/config/routes.php +++ b/config/routes.php @@ -59,6 +59,8 @@ Router::addGroup('/v1/',function (){ Router::post('PurchaseLimit/addShopCar', 'App\Controller\PurchaseLimitController@addShopCar'); Router::post('PurchaseLimit/updateShopCar', 'App\Controller\PurchaseLimitController@updateShopCar'); Router::post('PurchaseLimit/test', 'App\Controller\PurchaseLimitController@test'); + Router::post('PurchaseLimit/getStoreIdByMarketId', 'App\Controller\PurchaseLimitController@getStoreIdByMarketId'); + Router::post('Order/userComp', 'App\Controller\OrderController@userComp'); },['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); Router::addGroup('/wechat/',function () {