From 20d1a38a0f8049873f1fbbaef96c22e971ea9d77 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期三, 17 七月 2019 15:50:09 +0800
Subject: [PATCH] 搜索词

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java |  351 ++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 264 insertions(+), 87 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
index 209f9a1..cc9bd05 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/SearchControllerV2.java
@@ -6,13 +6,18 @@
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.annotation.Resource;
 
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
 import org.yeshi.utils.JsonUtil;
+import org.yeshi.utils.taobao.TbImgUtil;
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
@@ -30,6 +35,7 @@
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
+import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.config.BusinessSystemService;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
@@ -44,11 +50,13 @@
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.ThreadUtil;
+import com.yeshi.fanli.util.Utils;
 import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
 import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
 import com.yeshi.fanli.util.jd.JDUtil;
 import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
+import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
 import com.yeshi.fanli.util.taobao.SearchFilterUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
@@ -94,6 +102,177 @@
 	@Resource
 	private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
 
+	
+	
+	/**
+	 * 绮樿创鏉夸俊鎭帹鑽�
+	 * 
+	 * @param acceptData
+	 * @param url
+	 *            鍟嗗搧閾炬帴
+	 * @param out
+	 */
+	@RequestMapping(value = "getNewGoodsInfo", method = RequestMethod.POST)
+	public void getNewGoodsInfo(AcceptData acceptData, String text, PrintWriter out) {
+		if (StringUtil.isNullOrEmpty(text)) {
+			out.print(JsonUtil.loadFalseResult("鍊间负绌�"));
+			return;
+		}
+
+		if (text.length() > 256) {
+			out.print(JsonUtil.loadFalseResult("鍊艰繃闀�"));
+			return;
+		}
+
+		TaoBaoGoodsBrief tb = null;
+		String URL_REGEX = "(((http|https)://)|(www\\.))[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6}(:[0-9]{1,4})?(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
+
+		Pattern p = Pattern.compile(URL_REGEX);
+		Matcher matcher = p.matcher(text);
+		if (!matcher.find()) {// 涓嶅寘鍚摼鎺�
+			// 鍟嗗搧璇︽儏
+			// 鍙戠幇
+			// 娌℃湁閾炬帴锛屾爣棰樿繃闀夸篃涓嶅鐞�
+			if (text.startsWith("銆�") && text.contains("銆�")) {
+				int end = text.indexOf("銆�");
+				if (end > 2)
+					text = text.substring(1, end);
+			}
+
+			LogHelper.test("鏍规嵁绮樿创鏉挎帹鑽�:" + text);
+
+			if (text.length() > 80) {
+				out.print(JsonUtil.loadFalseResult("鍊艰繃闀�"));
+				return;
+			}
+
+			SearchFilter sf = new SearchFilter();
+			sf.setKey(text);
+			JSONObject root = new JSONObject();
+
+			TaoBaoSearchResult result = TaoBaoUtil.search(sf);
+			if (result != null && result.getTaoBaoGoodsBriefs() != null && result.getTaoBaoGoodsBriefs().size() > 0)
+				for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
+					// 鏄睘浜庢窐瀹濊仈鐩熷晢鍝�
+					if (goods.getTitle().equalsIgnoreCase(text)) {
+						root.put("type", 2);
+						JSONObject data = new JSONObject();
+						data.put("title", goods.getTitle());
+						root.put("data", data);
+						out.print(JsonUtil.loadTrueResult(root));
+						return;
+					}
+				}
+
+			// 鏌ヨ澶ф窐瀹㈡爣棰�
+			List<DaTaoKeDetail> list = daTaoKeGoodsDetailService.listByDtitle(text);
+			if (list != null && list.size() > 0) {
+				root.put("type", 2);
+				JSONObject data = new JSONObject();
+				data.put("title", list.get(0).getdTitle());
+				root.put("data", data);
+				out.print(JsonUtil.loadTrueResult(root));
+				return;
+			}
+
+			out.print(JsonUtil.loadFalseResult("鏆備笉鏀寔璇ョ被鍨嬶紒"));
+			return;
+		}
+
+		text = matcher.group();
+		if (text.contains("ju.taobao.com") || text.contains(".juhuasuan.com")) {// 鑱氬垝绠�
+			int index = text.indexOf("item_id");
+			if (index < 0) {
+				out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒"));
+				return;
+			}
+			text = text.substring(index);
+			int last = text.indexOf("&");
+			String id = "";
+			if (last > 0)
+				id = text.substring(text.indexOf("=") + 1, text.indexOf("&"));
+			else {
+				id = text.substring(text.indexOf("=" + 1));
+			}
+			tb = TaoBaoUtil.isAlimama(id);
+			if (tb == null) {
+				tb = TaoBaoUtil.parsePhoneTmAndTb(id);
+			}
+		} else if (text.contains("http://zmnxbc.com")) { // 鎵嬫満绔ぉ鐚獳PP鍒嗕韩
+			tb = TaoBaoUtil.parsePhoneShareUrlByTM(text);
+		} else if (text.contains("h5.m.taobao") || text.contains("detail.m.tmall") || text.contains("item.taobao")
+				|| text.contains("detail.tmall")) { // 鎵嬫満椤甸潰鍜岀數鑴戦〉闈�
+			Map<String, String> map = Utils.parseURL(text);
+			String id = "";
+			id = map.get("id").replace("}", "");
+			tb = TaoBaoUtil.isAlimama(id);
+			if (tb == null) {
+				tb = TaoBaoUtil.parsePhoneTmAndTb(id);
+			}
+		} else {
+			tb = TaoBaoUtil.parsePhoneShareUrlByTB(text);
+		}
+
+		if (tb == null) {
+			out.println(JsonUtil.loadFalseResult("鏆傛湭鎵惧埌璇ュ晢鍝侊紝璇风◢鍚庡啀璇曪紒"));
+			return;
+		}
+		JSONObject data = new JSONObject();
+		JSONObject taoBaoGoodsJSON = new JSONObject();
+		taoBaoGoodsJSON.put("title", tb.getTitle());
+		taoBaoGoodsJSON.put("zkPrice", tb.getZkPrice());
+		taoBaoGoodsJSON.put("auctionId", tb.getAuctionId());
+		taoBaoGoodsJSON.put("url", "http://item.taobao.com/item.htm?id=" + tb.getAuctionId());
+		data.put("taoBaoGoodsBrief", taoBaoGoodsJSON);
+		if (!StringUtil.isNullOrEmpty(tb.getPictUrl())) {
+			if (tb.getImgList() == null)
+				tb.setImgList(new ArrayList<>());
+			tb.getImgList().add(0, TbImgUtil.getTBSize220Img(tb.getPictUrl()));
+		}
+		data.put("tbImgs", tb.getImgList());
+		JSONObject root = new JSONObject();
+		root.put("type", 1);
+		root.put("data", data);
+
+		out.print(JsonUtil.loadTrueResult(root));
+	}
+	
+	
+	
+	/**
+	 * 鎼滅储鍊欓�夎瘝
+	 * 
+	 * @param acceptData
+	 * @param kw
+	 * @param out
+	 */
+	@RequestMapping(value = "suggestSearch", method = RequestMethod.POST)
+	public void getSugguestSearch(AcceptData acceptData, String kw, Integer goodsType, PrintWriter out) {
+		if (goodsType == null) {
+			out.print(JsonUtil.loadFalseResult("骞冲彴绫诲瀷涓嶈兘涓虹┖"));
+			return;
+		}
+
+		List<String> list = null;
+		if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
+			list = TaoBaoUtil.getSuguestSearch(kw);
+		} else if (goodsType == Constant.SOURCE_TYPE_JD) {
+			list = JDUtil.suggestSearch(kw);
+		} else if (goodsType == Constant.SOURCE_TYPE_PDD) {
+			list = PinDuoDuoUtil.suggestSearch(kw);
+		}
+
+		if (list == null || list.size() == 0) {
+			out.print(JsonUtil.loadFalseResult("鏆傛棤寤鸿鍐呭"));
+			return;
+		}
+
+		JSONArray array = new JSONArray();
+		for (String words : list) {
+			array.add(words);
+		}
+		out.print(JsonUtil.loadTrueResult(array));
+	}
 
 	/**
 	 * 鎼滅储-鏂扮増
@@ -102,9 +281,8 @@
 	 * @param kw
 	 * @param page
 	 * @param filter
-	 * @param order
-	 *            閿�閲忕敱楂樺埌浣�:1 銆� 浠锋牸浠庨珮鍒颁綆:2 銆� 浠锋牸浠庝綆鍒伴珮:3 銆� 鎺ㄥ箍閲忛珮鍒颁綆:4锛堢患鍚堥粯璁わ級銆佽繑鍒╂瘮楂樺埌浣�:5
-	 *            銆佽繑鍒╂瘮浣庡埌楂�:6 銆佹帹鑽�20
+	 * @param order      閿�閲忕敱楂樺埌浣�:1 銆� 浠锋牸浠庨珮鍒颁綆:2 銆� 浠锋牸浠庝綆鍒伴珮:3 銆� 鎺ㄥ箍閲忛珮鍒颁綆:4锛堢患鍚堥粯璁わ級銆佽繑鍒╂瘮楂樺埌浣�:5
+	 *                   銆佽繑鍒╂瘮浣庡埌楂�:6 銆佹帹鑽�20
 	 * @param startprice
 	 * @param endprice
 	 * @param fastFilter
@@ -112,10 +290,11 @@
 	 */
 	@RequestMapping(value = "searchGoods")
 	public void searchGoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice,
-			String endprice, Double startTkRate, Double endTkRate, String fastFilter, Integer goodsType, PrintWriter out) {
+			String endprice, Double startTkRate, Double endTkRate, String fastFilter, Integer goodsType,
+			PrintWriter out) {
 
 		String bid = getHistorySearchBid(acceptData);
-		
+
 		// 鍔犲叆鎼滅储鍘嗗彶璁板綍
 		historySearchService.addHistorySearch(kw, bid);
 
@@ -127,7 +306,7 @@
 			out.print(JsonUtil.loadTrueResult(data));
 			return;
 		}
-		
+
 		if (!StringUtil.isNullOrEmpty(fastFilter)) {
 			if (!StringUtil.isNullOrEmpty(filter)) {
 				JSONArray filterArray = JSONArray.fromObject(filter);
@@ -143,20 +322,18 @@
 		if (goodsType == null) {
 			goodsType = Constant.SOURCE_TYPE_TAOBAO;
 		}
-		
+
 		// 浜笢鍟嗗搧
 		if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) {
 			searchJDGoods(kw, page, filter, order, startprice, endprice, out);
 			return;
 		}
-		
+
+		// 鎷煎澶氬晢鍝� TODO
 		if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
-			// 鎷煎澶氬晢鍝� TODO
 			searchPDDGoods(kw, page, filter, order, startprice, endprice, out);
 			return;
 		}
-		
-		
 
 		// 鏄惁鏄帹鑽�
 		boolean recommend = false;
@@ -184,13 +361,13 @@
 		// 鑾峰彇鎺ㄨ崘璇�
 		List<String> listRecommendWords = new ArrayList<String>();
 		// 缁煎悎 鏌ヨ绗竴椤垫椂鑾峰彇鍊欓�夎瘝
-		if (page == 0) {
+		if (page == 1) {
 			listRecommendWords = TaoBaoUtil.getSuguestSearch(kw);
 			if (listRecommendWords == null || listRecommendWords.size() == 0) {
 				listRecommendWords = new ArrayList<String>();
 			}
 
-			List<TaoBaoShopVO> listShop =taoBaoShopService.getShopByKey(kw);
+			List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKey(kw);
 			if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoods() != null
 					&& listShop.get(0).getListGoods().size() > 2) {
 				data.put("shop", JsonUtil.getApiCommonGson().toJson(listShop.get(0)));
@@ -204,7 +381,6 @@
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
-	
 	private String getHistorySearchBid(AcceptData acceptData) {
 		StringBuffer sb = new StringBuffer();
 		String link = "#$$$#";
@@ -215,7 +391,6 @@
 		return StringUtil.Md5(sb.toString());
 	}
 
-	
 	/**
 	 * 鎵ц鎼滅储-鏂扮増
 	 * 
@@ -410,7 +585,7 @@
 		boolean ft = sf.isTmall();
 		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 		BigDecimal shareRate = hongBaoManageService.getShareRate();
-		
+
 		if (fq == 0 && fh == 0 && !ft) {
 			if (result != null && taoBaoGoodsBriefs != null)
 				for (TaoBaoGoodsBrief bf : taoBaoGoodsBriefs) {
@@ -422,18 +597,18 @@
 					list.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate));
 				}
 		}
-		
+
 		Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 				.excludeFieldsWithoutExposeAnnotation().create();
-		
+
 		data.put("result", gson2.toJson(list));
 		data.put("count", result.getTaoBaoHead().getDocsfound());
 		return data;
 	}
 
-
 	/**
 	 * 澶ф窐瀹㈠晢鍝�
+	 * 
 	 * @param key
 	 * @param page
 	 * @param filter
@@ -444,7 +619,6 @@
 	 */
 	private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice,
 			String endprice) {
-		page = page + 1;
 		int sort = DaTaoKeApiUtil.SORT_DEFAULT;
 		if ("5".equalsIgnoreCase(order)) {
 			sort = DaTaoKeApiUtil.SORT_COMMISSION;
@@ -510,9 +684,9 @@
 			}
 		}
 	}
-	
+
 	/**
-	 *  浜笢
+	 * 浜笢
 	 * 
 	 * @param kw
 	 * @param page
@@ -522,8 +696,8 @@
 	 * @param endprice
 	 * @return
 	 */
-	private void searchJDGoods(String kw, int page, String filter, String order, String startprice,
-			String endprice, PrintWriter out) {
+	private void searchJDGoods(String kw, int page, String filter, String order, String startprice, String endprice,
+			PrintWriter out) {
 		JDSearchFilter jdfilter = new JDSearchFilter();
 		jdfilter.setKey(SearchFilterUtil.filterSearchContent(kw));
 		jdfilter.setPageNo(page);
@@ -536,42 +710,43 @@
 		if (!StringUtil.isNullOrEmpty(endprice)) {
 			jdfilter.setToPrice(Integer.parseInt(endprice));
 		}
-		
-		
+
 		int sort = 1;
 		if (!StringUtil.isNullOrEmpty(order)) {
 			sort = Integer.parseInt(order);
 		}
-		
+
 		switch (sort) {
-			case 1: // 閿�閲� desc
-				jdfilter.setSort(JDSearchFilter.SORT_DESC);
-				jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
-				break;
-			case 2: // 浠锋牸鈥攄esc
-				jdfilter.setSort(JDSearchFilter.SORT_DESC);
-				jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
-				break;
-			case 3: // 浠锋牸鈥攁sc
-				jdfilter.setSort(JDSearchFilter.SORT_ASC);
-				jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
-				break;
-			case 5: // 杩斿埄姣斺�攁sc
-				jdfilter.setSort(JDSearchFilter.SORT_DESC);
-				jdfilter.setSortName(JDSearchFilter.SORTNAME_COMMISSION_SHARE);
-				break;
-			default: // 榛樿锛氶攢閲� desc
-				jdfilter.setSort(JDSearchFilter.SORT_DESC);
-				jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
-				break;
+		case 1: // 閿�閲� desc
+			jdfilter.setSort(JDSearchFilter.SORT_DESC);
+			jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
+			break;
+		case 2: // 浠锋牸鈥攄esc
+			jdfilter.setSort(JDSearchFilter.SORT_DESC);
+			jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
+			break;
+		case 3: // 浠锋牸鈥攁sc
+			jdfilter.setSort(JDSearchFilter.SORT_ASC);
+			jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
+			break;
+		case 5: // 杩斿埄姣斺�擠ESC
+			jdfilter.setSort(JDSearchFilter.SORT_DESC);
+			jdfilter.setSortName(JDSearchFilter.SORTNAME_COMMISSION_SHARE);
+			break;
+		default: // 榛樿锛氶攢閲� desc
+			// jdfilter.setSort(JDSearchFilter.SORT_DESC);
+			// jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
+			break;
 		}
 
 		if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filter)) {
 			JSONArray array = JSONArray.fromObject(filter);
 			for (int i = 0; i < array.size(); i++) {
 				String ty = array.optJSONObject(i).optString("type");
-				 if ("quantype".equalsIgnoreCase(ty)) {
-					 jdfilter.setHasCoupon(1); // 鏈夊埜
+				if ("quantype".equalsIgnoreCase(ty)) {
+					jdfilter.setHasCoupon(1); // 鏈夊埜
+				} else if ("zy".equalsIgnoreCase(ty)) {
+					jdfilter.setIsZY(1); // 鏄惁鑷惀
 				}
 			}
 		}
@@ -585,28 +760,28 @@
 			if (pageEntity != null) {
 				count = pageEntity.getTotalCount();
 			}
-			
+
 			List<JDGoods> goodsList = result.getGoodsList();
 			if (goodsList != null && goodsList.size() > 0) {
 				BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 				BigDecimal shareRate = hongBaoManageService.getShareRate();
 				Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 						.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
-				for (JDGoods goods: goodsList) {
-					GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, null, fanLiRate, shareRate);
+				for (JDGoods goods : goodsList) {
+					GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, null, fanLiRate,
+							shareRate);
 					array.add(gson.toJson(goodsDetailVO));
 				}
 			}
 		}
-		
+
 		data.put("result", array);
 		data.put("count", count);
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
-	
 	/**
-	 *  浜笢
+	 * 浜笢
 	 * 
 	 * @param kw
 	 * @param page
@@ -616,8 +791,8 @@
 	 * @param endprice
 	 * @return
 	 */
-	private void searchPDDGoods(String kw, int page, String filter, String order, String startprice,
-			String endprice, PrintWriter out) {
+	private void searchPDDGoods(String kw, int page, String filter, String order, String startprice, String endprice,
+			PrintWriter out) {
 		PDDSearchFilter pddfilter = new PDDSearchFilter();
 		pddfilter.setKw(SearchFilterUtil.filterSearchContent(kw));
 		pddfilter.setPage(page);
@@ -627,38 +802,39 @@
 		if (!StringUtil.isNullOrEmpty(order)) {
 			sort = Integer.parseInt(order);
 		}
-		
+
 		switch (sort) {
-			case 1: // 閿�閲� desc
-				pddfilter.setSortType(6);
-				break;
-			case 2: // 浠锋牸鈥攄esc
-				pddfilter.setSortType(4);
-				break;
-			case 3: // 浠锋牸鈥攁sc
-				pddfilter.setSortType(3);
-				break;
-			case 5: // 杩斿埄姣斺�攁sc
-				pddfilter.setSortType(2);
-				break;
-			case 6: // 杩斿埄姣斺�攁sc
-				pddfilter.setSortType(1);
-				break;
-			case 20: // 缁煎悎鎺掑簭
-				pddfilter.setSortType(0);
-				break;
-			default: // 榛樿锛氶攢閲� desc
-				pddfilter.setSortType(6);
-				break;
+		case 1: // 閿�閲� desc
+			pddfilter.setSortType(6);
+			break;
+		case 2: // 浠锋牸鈥攄esc
+			pddfilter.setSortType(4);
+			break;
+		case 3: // 浠锋牸鈥攁sc
+			pddfilter.setSortType(3);
+			break;
+		case 5: // 杩斿埄姣斺�攁sc
+			pddfilter.setSortType(2);
+			break;
+		case 6: // 杩斿埄姣斺�攁sc
+			pddfilter.setSortType(1);
+			break;
+		case 20: // 缁煎悎鎺掑簭
+			pddfilter.setSortType(0);
+			break;
+		default: // 榛樿锛氶攢閲� desc
+			// pddfilter.setSortType(6);
+			break;
 		}
-		
-		
+
 		if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(filter)) {
 			JSONArray array = JSONArray.fromObject(filter);
 			for (int i = 0; i < array.size(); i++) {
 				String ty = array.optJSONObject(i).optString("type");
-				 if ("quantype".equalsIgnoreCase(ty)) {
-					 pddfilter.setHasCoupon(true); // 鏈夊埜
+				if ("quantype".equalsIgnoreCase(ty)) {
+					pddfilter.setHasCoupon(true); // 鏈夊埜
+				} else if ("brand".equalsIgnoreCase(ty)) {
+					pddfilter.setIsBrand(true); // 鏄惁鏄搧鐗�
 				}
 			}
 		}
@@ -666,7 +842,7 @@
 		int count = 0;
 		JSONObject data = new JSONObject();
 		JSONArray array = new JSONArray();
-		
+
 		PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
 		if (result != null) {
 			count = result.getTotalCount();
@@ -676,13 +852,14 @@
 				BigDecimal shareRate = hongBaoManageService.getShareRate();
 				Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 						.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
-				for (PDDGoodsDetail goods: goodsList) {
-					GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, null, fanLiRate, shareRate);
+				for (PDDGoodsDetail goods : goodsList) {
+					GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, null, fanLiRate,
+							shareRate);
 					array.add(gson.toJson(goodsDetailVO));
 				}
 			}
 		}
-		
+
 		data.put("result", array);
 		data.put("count", count);
 		out.print(JsonUtil.loadTrueResult(data));

--
Gitblit v1.8.0