|
@@ -150,6 +150,38 @@ public class CartHandlers {
|
|
|
return remsg;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据颜色id获取购物车数量
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @ResponseBody
|
|
|
+ @RequestMapping("/getCartColorNum")
|
|
|
+ public ResultMsg getCartColorNum(@RequestParam("colorId") Integer colorId,
|
|
|
+ HttpServletRequest request) throws Exception {
|
|
|
+ ResultMsg remsg=new ResultMsg();
|
|
|
+ Member member = WechatUtils.getUserBySession(request);
|
|
|
+ String openId = member.getUserOpenid();
|
|
|
+
|
|
|
+ CartDto cartDto = new CartDto();
|
|
|
+ cartDto.setCartColorId(colorId);
|
|
|
+ cartDto.setCartOpenId(openId);
|
|
|
+ cartDto = this.cartService.getCartDto(cartDto);
|
|
|
+
|
|
|
+ Integer num = 0;
|
|
|
+ if(cartDto != null && cartDto.getCartNum() != null){
|
|
|
+ num = cartDto.getCartNum();
|
|
|
+ }
|
|
|
+ remsg.setMessage(NameUtils.getConfig("SUCCESSINFO"));
|
|
|
+ remsg.setStatus(true);
|
|
|
+ remsg.setResultCode(ResultInfo.SUCCESSCODE);
|
|
|
+ remsg.setData(num);
|
|
|
+ return remsg;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 首页添加商品到购物车post
|
|
|
* @param cartNum
|