| | |
| | | throw new ServiceException(ResultCode.CART_ERROR); |
| | | } |
| | | } |
| | | @ApiOperation(value = "向购物车中覆盖添加一个产品") |
| | | @PostMapping("/addCard") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "skuId", value = "产品ID", required = true, dataType = "Long", paramType = "query"), |
| | | @ApiImplicitParam(name = "num", value = "此产品的购买数量", required = true, dataType = "int", paramType = "query"), |
| | | @ApiImplicitParam(name = "cartType", value = "购物车类型,默认加入购物车", paramType = "query") |
| | | }) |
| | | public ResultMessage<Object> addCard(@NotNull(message = "产品id不能为空") String skuId, |
| | | @NotNull(message = "购买数量不能为空") @Min(value = 1, message = "加入购物车数量必须大于0") Integer num) { |
| | | try { |
| | | //读取选中的列表 |
| | | cartService.add(skuId, num, CartTypeEnum.CART.name(), true); |
| | | return ResultUtil.success(); |
| | | } catch (ServiceException se) { |
| | | log.info(se.getMsg(), se); |
| | | throw se; |
| | | } catch (Exception e) { |
| | | log.error(ResultCode.CART_ERROR.message(), e); |
| | | throw new ServiceException(ResultCode.CART_ERROR); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取购物车页面购物车详情") |