From d8359ddb48dab5cc797a9d552e11fde571f4920c Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 27 八月 2019 12:32:46 +0800
Subject: [PATCH] Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java |   66 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 8 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 b7b968e..8424964 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
@@ -53,6 +53,7 @@
 import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.factory.MonitorFactory;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
+import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 import com.yeshi.fanli.vo.goods.GoodsDetailVO;
@@ -167,6 +168,8 @@
 			}
 
 			root.put("spikeGoods", getSpikeGoodsContent(acceptData));
+			if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion()))
+				root.put("scoreExchange", getScoreExchangeInfo(acceptData));
 
 			out.print(JsonUtil.loadTrueResult(root));
 		} catch (Exception e) {
@@ -192,23 +195,25 @@
 	}
 
 	private JSONObject getSpikeGoodsContent(AcceptData acceptData) {
-		List<String> dtoList = daTaoKeGoodsDetailV2Service.getDingDongQiangTime();
+		List<String> dtoList = DaTaoKeUtil.getDingDongQiangTime();
 		long nowTime = System.currentTimeMillis();
 		int dateNum = Integer.parseInt(TimeUtil.getGernalTime(nowTime, "ddHH"));
 		String timeStr = null;
 		int nextPos = 0;
-		for (int i = 0; i < dtoList.size(); i++) {
-			if (dateNum <= Integer.parseInt(dtoList.get(i))) {
+		for (int i = 0; i < dtoList.size() - 1; i++) {
+			if (dateNum >= Integer.parseInt(dtoList.get(i)) && dateNum < Integer.parseInt(dtoList.get(i + 1))) {
 				timeStr = dtoList.get(i);
 				nextPos = i + 1;
 				break;
 			}
 		}
+		if (timeStr == null)
+			timeStr = dtoList.get(dtoList.size() - 1);
 
 		long nextTime = nowTime + 1000 * 60 * 60L;// 榛樿涓�1灏忔椂
 		if (nextPos < dtoList.size()) {
-			nextTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "MM") + dtoList.get(nextPos),
-					"MMddHH");
+			nextTime = TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(nowTime, "yyyyMM") + dtoList.get(nextPos),
+					"yyyyMMddHH");
 		}
 
 		JSONArray array = null;
@@ -282,16 +287,61 @@
 		Long endTime = nextTime - nowTime;
 
 		JSONObject root = new JSONObject();
+
+		if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
+			root.put("time", nextTime);
+			root.put("endTime", endTime > 0 ? endTime : 0);
+			JSONArray imgArray = new JSONArray();
+			if (array != null)
+				for (int i = 0; i < array.size(); i++) {
+					imgArray.add(array.optJSONObject(i).optJSONObject("goods").optString("picUrl"));
+				}
+			root.put("imgList", imgArray);
+			JSONObject params = new JSONObject();
+			params.put("url", configService.get("spike_goods_link"));
+			root.put("params", params);
+			root.put("jumpDetail", jumpDetail);
+			root.put("name", "闄愭椂绉掓潃");
+			root.put("desc", "鏁寸偣鏇存柊锛屽ソ鐗╂姠璐�");
+		} else {
+			root.put("time", nextTime);
+			root.put("endTime", endTime > 0 ? endTime : 0);
+			root.put("listgoods", array);
+			JSONObject params = new JSONObject();
+			params.put("url", configService.get("spike_goods_link"));
+			root.put("params", params);
+			root.put("jumpDetail", jumpDetail);
+		}
+
 		root.put("time", nextTime);
 		root.put("endTime", endTime > 0 ? endTime : 0);
 		root.put("listgoods", array);
 
+		return root;
+	}
+
+	/**
+	 * 閲戝竵鍏戞崲淇℃伅
+	 * 
+	 * @param acceptData
+	 * @return
+	 */
+	private JSONObject getScoreExchangeInfo(AcceptData acceptData) {
+
+		JSONObject root = new JSONObject();
+		JSONArray array = new JSONArray();
+		array.add("http://img.flqapp.com/resource/integral/integral_home_icon_2.png");
+		array.add("http://img.flqapp.com/resource/integral/integral_home_icon_1.png");
+		root.put("imgList", array);
 		JSONObject params = new JSONObject();
-		params.put("url", configService.get("spike_goods_link"));
-
+		params.put("balanceMore", true);
 		root.put("params", params);
-		root.put("jumpDetail", jumpDetail);
+		root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("integralExchange",
+				Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion())));
 
+		root.put("name", "閲戝竵鍏戞崲");
+		root.put("desc", "姣忔棩绛惧埌锛屾儕鍠滀笉鍋�");
+		root.put("tagImg", "http://img.flqapp.com/resource/score_exchange_tag.png");
 		return root;
 	}
 

--
Gitblit v1.8.0