Browse Source

no message

master
weigang 5 years ago
parent
commit
135a72b1d4
  1. 9
      app/Controller/v3/OrderOnlineController.php
  2. 4
      app/Controller/v3/ShopCartUpdateController.php
  3. 11
      app/Service/v3/Implementations/OrderOnlineService.php

9
app/Controller/v3/OrderOnlineController.php

@ -206,15 +206,6 @@ class OrderOnlineController extends BaseController
// 下单
$params = $request->validated();
// TODO 校验当前用户今天是否超过了购买活动秒杀商品的(特定价格)的订单笔数
if (!$this->orderOnlineService->checkIfBuyFlashGoodsToday($params['user_id'])) {
throw new ErrorCodeException(
ErrorCode::ORDER_ONLINE_LIMIT_BUY_COUNT,
'['.env('LIMIT_BUY_COUNT').']',
['params' => $params, 'limit_prices' => env('LIMIT_BUY_COUNT_GOODS_PRICES')]
);
}
$couponIds = isset($params['coupon_ids'])&&$params['coupon_ids'] ? explode(',', $params['coupon_ids']) : [];
$data = $this->orderOnlineService->do(
$params['market_id'],

4
app/Controller/v3/ShopCartUpdateController.php

@ -29,14 +29,16 @@ class ShopCartUpdateController extends BaseController
$num = $this->request->input('num',0);
$activityType = $this->request->input('activity_type',1);
if ($activityType == 2) {
// TODO 校验当前用户今天是否超过了购买活动秒杀商品的(特定价格)的订单笔数
if (!$this->orderOnlineService->checkIfBuyFlashGoodsToday($userId)) {
throw new ErrorCodeException(
ErrorCode::ORDER_ONLINE_LIMIT_BUY_COUNT,
'['.env('LIMIT_BUY_COUNT').']',
'[' . env('LIMIT_BUY_COUNT') . ']',
['params' => $this->request->all(), 'limit_prices' => env('LIMIT_BUY_COUNT_GOODS_PRICES')]
);
}
}
$res = $this->shopCarServiceUpdate->do($userId,$goodsId,$num,$activityType);
return $this->success($res);

11
app/Service/v3/Implementations/OrderOnlineService.php

@ -267,6 +267,15 @@ class OrderOnlineService implements OrderOnlineServiceInterface
}
}
// TODO 校验当前用户今天是否超过了购买活动秒杀商品的(特定价格)的订单笔数
if (!$this->checkIfBuyFlashGoodsToday($userId)) {
throw new ErrorCodeException(
ErrorCode::ORDER_ONLINE_LIMIT_BUY_COUNT,
'['.env('LIMIT_BUY_COUNT').']',
['params' => $userId, 'limit_prices' => env('LIMIT_BUY_COUNT_GOODS_PRICES')]
);
}
$check = $this->goodsActivityService->check($goods, $cart->num, $userId);
if (true !== $check) {
throw new ErrorCodeException($check, '['.$goods->name.']');
@ -821,7 +830,7 @@ class OrderOnlineService implements OrderOnlineServiceInterface
$goodsTable = ApplicationContext::getContainer()->get(OrderGoods::class)->getTable();
$limitPrices = explode(',', env('LIMIT_BUY_COUNT_GOODS_PRICES'));
$limitCount = env('LIMIT_BUY_COUNT');
$limitCount = intval(env('LIMIT_BUY_COUNT'));
$countToday = OrderMain::query()
->join($orderTable, $orderTable.'.order_main_id', '=', $mainTable.'.global_order_id')

Loading…
Cancel
Save