From 0d9ac58dc11f54351e5e18dba8e950717d78019f Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 09 九月 2019 14:55:24 +0800
Subject: [PATCH] 搜索发现

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java |   80 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 79 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
index 9af3056..e7ff7df 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java
@@ -12,6 +12,7 @@
 
 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 com.google.gson.Gson;
@@ -27,6 +28,7 @@
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
 import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
+import com.yeshi.fanli.exception.integral.IntegralExchangeException;
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
 import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -58,7 +60,9 @@
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 import com.yeshi.fanli.vo.goods.GoodsDetailVO;
 import com.yeshi.fanli.vo.goods.OtherInfo;
+import com.yeshi.fanli.vo.integral.ExchangeTipVO;
 import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
+import com.yeshi.fanli.vo.search.SearchKeyVO;
 import com.yeshi.fanli.vo.tlj.ReduceHongBao;
 
 import net.sf.json.JSONArray;
@@ -165,7 +169,10 @@
 			root.put("spikeGoods", getSpikeGoodsContent(acceptData));
 			if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
 				root.put("scoreExchange", getScoreExchangeInfo(acceptData));
-
+			
+			if (VersionUtil.greaterThan_2_0_0(acceptData.getPlatform(), acceptData.getVersion()))
+				root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData));
+			
 			out.print(JsonUtil.loadTrueResult(root));
 		} catch (Exception e) {
 			out.print(JsonUtil.loadFalseResult(1, "鑾峰彇鏁版嵁澶辫触"));
@@ -339,6 +346,46 @@
 		root.put("tagImg", "http://img.flqapp.com/resource/score_exchange_tag.png");
 		return root;
 	}
+	
+	
+	/**
+	 * 閲戝竵鍏戞崲淇℃伅
+	 * 
+	 * @param acceptData
+	 * @return
+	 */
+	private JSONObject getSearchDiscoveryInfo(AcceptData acceptData) {
+		JSONArray array = new JSONArray();
+		String keys = configService.getSearchDiscoveryKeys();
+		if (!StringUtil.isNullOrEmpty(keys)) {
+			JSONArray arrayKeys = JSONArray.fromObject(keys);
+			for (int i = 0; i < arrayKeys.size(); i++) {
+				String name = arrayKeys.get(i).toString();
+				JSONObject params = new JSONObject();
+				params.put("searchKey", name);
+				
+				SearchKeyVO keyVO = new SearchKeyVO();
+				keyVO.setName(name);
+				keyVO.setParams(params.toString());
+				array.add(keyVO);
+			}
+		}
+		
+		JSONObject params = new JSONObject();
+		params.put("url", configService.get("search_discovery_h5_link"));
+		
+		JSONObject root = new JSONObject();
+		root.put("picture", "http://img.flqapp.com/resource/home_search_found.png");
+		root.put("params", params);
+		root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web",
+				Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
+		
+		root.put("jumpResult", jumpDetailV2Service.getByTypeCache("search_goods_result",
+				Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
+		root.put("keyList", array);
+		return root;
+	}
+	
 
 	/**
 	 * 棣栭〉搴曢儴鍟嗗搧鎺ㄨ崘
@@ -603,4 +650,35 @@
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
+	
+	 
+	@RequestMapping(value = "getSearchDiscoveryTop", method = RequestMethod.POST)
+	public void getSearchDiscoveryTop(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
+//		try {
+//			String keys = configService.getSearchDiscoveryKeys();
+//			if (!StringUtil.isNullOrEmpty(keys)) {
+//				JSONArray arrayKeys = JSONArray.fromObject(keys);
+//				for (int i = (page-1) * 3; i < arrayKeys.size(); i++) {
+//					String keys = arrayKeys.get(i).toString();
+//				}
+//				
+//				
+//			}
+//			
+			
+			
+			
+			
+			
+//
+//			GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
+//			Gson gson = gsonBuilder.create();
+//			JSONObject data = new JSONObject();
+//			data.put("result", gson.toJson(exchange));
+//			out.print(JsonUtil.loadTrueResult(data));
+//		} catch (IntegralExchangeException e) {
+//			out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+//		}
+	}
+	
 }

--
Gitblit v1.8.0