| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.service.ShoppingCartService; |
| | | import com.ruoyi.order.vo.*; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Resource |
| | | private ShoppingCartService shoppingCartService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ResponseBody |
| | | @PostMapping("/setGoodsNumber") |
| | | @ApiOperation(value = "修改购物车数量", tags = {"商城-购物车-小程序"}) |
| | | public AjaxResult setGoodsNumber(@RequestBody SetGoodsNumber setGoodsNumber){ |
| | | public R setGoodsNumber(@RequestBody SetGoodsNumber setGoodsNumber){ |
| | | return shoppingCartService.setGoodsNumber(setGoodsNumber); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/delShoppingCart") |
| | | @ApiOperation(value = "删除购物车", tags = {"商城-购物车-小程序"}) |
| | | public R delShoppingCart(Long id){ |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | ShoppingCart shoppingCart = shoppingCartService.getById(id); |
| | | if(!userid.equals(shoppingCart.getAppUserId())){ |
| | | return R.fail("权限不足,不允许此操作"); |
| | | } |
| | | shoppingCartService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/confirmOrder") |
| | | @ApiOperation(value = "确定购物车订单", tags = {"商城-购物车-小程序"}) |
| | | public AjaxResult<ConfirmOrderVo> confirmOrder(@RequestBody ConfirmOrder confirmOrder){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | public R<ConfirmOrderVo> confirmOrder(@RequestBody ConfirmOrder confirmOrder){ |
| | | ConfirmOrderVo confirmOrderVo = shoppingCartService.confirmOrder(confirmOrder); |
| | | return R.ok(confirmOrderVo); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/shoppingCartPayment") |
| | | @ApiOperation(value = "购物车订单支付", tags = {"商城-购物车-小程序"}) |
| | | public AjaxResult<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | // todo 待完善 pu |
| | | return AjaxResult.success(); |
| | | public R<Void> shoppingCartPayment(@RequestBody ShoppingCartPayment shoppingCartPayment){ |
| | | return shoppingCartService.shoppingCartPayment(shoppingCartPayment); |
| | | } |
| | | |
| | | |