|
@@ -11,8 +11,11 @@ import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.iamberry.wechat.core.entity.admin.ShopSystemRule;
|
|
import com.iamberry.wechat.core.entity.admin.ShopSystemRule;
|
|
|
|
+import com.iamberry.wechat.core.entity.cart.CartDto;
|
|
import com.iamberry.wechat.core.entity.product.*;
|
|
import com.iamberry.wechat.core.entity.product.*;
|
|
import com.iamberry.wechat.core.entity.search.SearchInfo;
|
|
import com.iamberry.wechat.core.entity.search.SearchInfo;
|
|
|
|
+import com.iamberry.wechat.face.cart.CartService;
|
|
|
|
+import com.iamberry.wechat.service.cart.dao.CartDao;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -66,6 +69,9 @@ public class ProductInfoHandler {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SystemService systemService;
|
|
private SystemService systemService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CartService cartService;
|
|
/**
|
|
/**
|
|
* 首页进入商城
|
|
* 首页进入商城
|
|
* @param request
|
|
* @param request
|
|
@@ -527,8 +533,27 @@ public class ProductInfoHandler {
|
|
remsg.setMessage(ResultInfo.loginOutError);
|
|
remsg.setMessage(ResultInfo.loginOutError);
|
|
return remsg;
|
|
return remsg;
|
|
}
|
|
}
|
|
|
|
+ Member member = wechatUtils.getUserBySession(request);
|
|
|
|
+ if (member == null || member.getUserOpenid() == null) {
|
|
|
|
+ remsg.setMessage(ResultInfo.loginOutError);
|
|
|
|
+ remsg.setStatus(false);
|
|
|
|
+ remsg.setMessage(ResultInfo.loginOutError);
|
|
|
|
+ return remsg;
|
|
|
|
+ }
|
|
//查询所有产品颜色
|
|
//查询所有产品颜色
|
|
List<ProductColor> productColorList = productInfoService.selectColorByPid(productId);
|
|
List<ProductColor> productColorList = productInfoService.selectColorByPid(productId);
|
|
|
|
+ if(productColorList.size() > 0){
|
|
|
|
+ for (ProductColor color : productColorList){
|
|
|
|
+ CartDto cartDto = new CartDto();
|
|
|
|
+ cartDto.setCartColorId(color.getColorId());
|
|
|
|
+ cartDto.setCartOpenId(member.getUserOpenid());
|
|
|
|
+ cartDto = cartService.getCartByOpenId(cartDto);
|
|
|
|
+ if(cartDto != null){
|
|
|
|
+ color.setCartId(cartDto.getCartId());
|
|
|
|
+ color.setCartNum(cartDto.getCartNum());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
map.put("productColorList", productColorList);
|
|
map.put("productColorList", productColorList);
|
|
remsg.setMessage(ResultInfo.SUCCESSINFO);
|
|
remsg.setMessage(ResultInfo.SUCCESSINFO);
|