| | |
| | | package com.ruoyi.goods.controller.miniapp; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.dto.AppGoodsInfoGetDto; |
| | |
| | | import com.ruoyi.goods.domain.vo.AppShoppingCartVo; |
| | | import com.ruoyi.goods.service.goods.GoodsService; |
| | | import com.ruoyi.goods.service.goods.ShoppingCartService; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.AppBaseBathDto; |
| | | import com.ruoyi.system.api.domain.poji.member.Member; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | |
| | | } |
| | | } |
| | | if(appGoodsInfoGetDto.getShopId()==null){ |
| | | //throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | appGoodsInfoGetDto.setShopId(1L); |
| | | throw new ServiceException(AppErrorConstant.NO_POSITION); |
| | | } |
| | | AppGoodsInfoVo appGoodsInfoVo = goodsService.getGoodsInfo(appGoodsInfoGetDto); |
| | | return R.ok(appGoodsInfoVo); |
| | |
| | | if(userId != null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | appShoppingCartAddDto.setUserId(userId); |
| | | if(appShoppingCartAddDto.getShopId()==null&&member!=null&&member.getRelationShopId()!=null){ |
| | | if(member!=null&&member.getBindingFlag()==1&&member.getRelationShopId()!=null){ |
| | | appShoppingCartAddDto.setShopId(member.getRelationShopId()); |
| | | } |
| | | } |
| | |
| | | if(userId!=null){ |
| | | Member member = memberService.getMember(userId).getData(); |
| | | appShoppingCartChangeDto.setUserId(userId); |
| | | if(member!=null&&member.getRelationShopId()!=null){ |
| | | if(member!=null&&member.getBindingFlag()==1&&member.getRelationShopId()!=null){ |
| | | appShoppingCartChangeDto.setShopId(member.getRelationShopId()); |
| | | } |
| | | } |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/countShoppingCart", method = RequestMethod.POST) |
| | | @ApiOperation(value = "获取购物车数量") |
| | | public R<Integer> countShoppingCart() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Member member = memberService.getMember(userId).getData(); |
| | | Long shopId = member.getRelationShopId(); |
| | | Integer count = shoppingCartService.countShoppingCart(userId, shopId); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | } |