|
|
@@ -1,5 +1,12 @@
|
|
|
package org.linlinjava.litemall.wx.web;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
@@ -9,18 +16,19 @@ import org.linlinjava.litemall.core.validator.Order;
|
|
|
import org.linlinjava.litemall.core.validator.Sort;
|
|
|
import org.linlinjava.litemall.db.domain.LitemallCollect;
|
|
|
import org.linlinjava.litemall.db.domain.LitemallGoods;
|
|
|
+import org.linlinjava.litemall.db.domain.LitemallTopic;
|
|
|
import org.linlinjava.litemall.db.service.LitemallCollectService;
|
|
|
import org.linlinjava.litemall.db.service.LitemallGoodsService;
|
|
|
+import org.linlinjava.litemall.db.service.LitemallTopicService;
|
|
|
import org.linlinjava.litemall.wx.annotation.LoginUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
* 用户收藏服务
|
|
|
@@ -35,6 +43,8 @@ public class WxCollectController {
|
|
|
private LitemallCollectService collectService;
|
|
|
@Autowired
|
|
|
private LitemallGoodsService goodsService;
|
|
|
+ @Autowired
|
|
|
+ private LitemallTopicService topicService;
|
|
|
|
|
|
/**
|
|
|
* 用户收藏列表
|
|
|
@@ -64,13 +74,21 @@ public class WxCollectController {
|
|
|
c.put("id", collect.getId());
|
|
|
c.put("type", collect.getType());
|
|
|
c.put("valueId", collect.getValueId());
|
|
|
-
|
|
|
- LitemallGoods goods = goodsService.findById(collect.getValueId());
|
|
|
- c.put("name", goods.getName());
|
|
|
- c.put("brief", goods.getBrief());
|
|
|
- c.put("picUrl", goods.getPicUrl());
|
|
|
- c.put("retailPrice", goods.getRetailPrice());
|
|
|
-
|
|
|
+ if (type == (byte)0){
|
|
|
+ //查询商品信息
|
|
|
+ LitemallGoods goods = goodsService.findById(collect.getValueId());
|
|
|
+ c.put("name", goods.getName());
|
|
|
+ c.put("brief", goods.getBrief());
|
|
|
+ c.put("picUrl", goods.getPicUrl());
|
|
|
+ c.put("retailPrice", goods.getRetailPrice());
|
|
|
+ } else {
|
|
|
+ //查询专题信息
|
|
|
+ LitemallTopic topic = topicService.findById(collect.getValueId());
|
|
|
+ c.put("title", topic.getTitle());
|
|
|
+ c.put("subtitle", topic.getTitle());
|
|
|
+ c.put("price", topic.getPrice());
|
|
|
+ c.put("picUrl", topic.getPicUrl());
|
|
|
+ }
|
|
|
collects.add(c);
|
|
|
}
|
|
|
|