Browse Source

banner mock数据

master
Lemon 5 years ago
parent
commit
c29fd47aa3
  1. 6
      app/Controller/PurchaseLimitController.php
  2. 18
      app/Service/PurchaseLimitService.php
  3. 2
      app/Service/PurchaseLimitServiceInterface.php
  4. 2
      config/routes.php

6
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());

18
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;

2
app/Service/PurchaseLimitServiceInterface.php

@ -10,5 +10,7 @@ interface PurchaseLimitServiceInterface
public function updateShopCar($params);
public function getStoreIdByMarketId($params);
public function test($params);
}

2
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 () {

Loading…
Cancel
Save