|
|
@ -2,12 +2,21 @@ |
|
|
|
|
|
|
|
|
namespace App\Controller\v3; |
|
|
namespace App\Controller\v3; |
|
|
|
|
|
|
|
|
|
|
|
use App\Constants\v3\ErrorCode; |
|
|
use App\Controller\BaseController; |
|
|
use App\Controller\BaseController; |
|
|
|
|
|
use App\Exception\ErrorCodeException; |
|
|
|
|
|
use App\Service\v3\Interfaces\OrderOnlineServiceInterface; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
use App\Service\v3\Interfaces\ShopCartUpdateServiceInterface; |
|
|
use App\Service\v3\Interfaces\ShopCartUpdateServiceInterface; |
|
|
use App\Request\v3\ShopCartUpdateRequest; |
|
|
use App\Request\v3\ShopCartUpdateRequest; |
|
|
class ShopCartUpdateController extends BaseController |
|
|
class ShopCartUpdateController extends BaseController |
|
|
{ |
|
|
{ |
|
|
|
|
|
/** |
|
|
|
|
|
* @Inject |
|
|
|
|
|
* @var OrderOnlineServiceInterface |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $orderOnlineService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Inject |
|
|
* @Inject |
|
|
* @var ShopCartUpdateServiceInterface |
|
|
* @var ShopCartUpdateServiceInterface |
|
|
@ -19,6 +28,16 @@ class ShopCartUpdateController extends BaseController |
|
|
$goodsId = $this->request->input('goods_id',0); |
|
|
$goodsId = $this->request->input('goods_id',0); |
|
|
$num = $this->request->input('num',0); |
|
|
$num = $this->request->input('num',0); |
|
|
$activityType = $this->request->input('activity_type',1); |
|
|
$activityType = $this->request->input('activity_type',1); |
|
|
|
|
|
|
|
|
|
|
|
// TODO 校验当前用户今天是否超过了购买活动秒杀商品的(特定价格)的订单笔数
|
|
|
|
|
|
if (!$this->orderOnlineService->checkIfBuyFlashGoodsToday($userId)) { |
|
|
|
|
|
throw new ErrorCodeException( |
|
|
|
|
|
ErrorCode::ORDER_ONLINE_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); |
|
|
$res = $this->shopCarServiceUpdate->do($userId,$goodsId,$num,$activityType); |
|
|
return $this->success($res); |
|
|
return $this->success($res); |
|
|
} |
|
|
} |
|
|
|