From 01e773cf27e572b8fb83538d85f31130930d93d1 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 15 八月 2019 15:57:23 +0800
Subject: [PATCH] 券赠送

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/RecommendControllerV2.java |   76 ++++++++++++++++++++++++++++++++++---
 1 files changed, 69 insertions(+), 7 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 eb27792..b256ee3 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
@@ -41,6 +41,7 @@
 import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
 import com.yeshi.fanli.service.inter.monitor.MonitorService;
 import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
+import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
 import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.Constant;
@@ -109,6 +110,9 @@
 	@Resource
 	private PDDGoodsService pddGoodsService;
 
+	@Resource
+	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
+
 	/**
 	 * 鏂扮増鎺ㄨ崘涓撻绠$悊(1.5.3)
 	 * 
@@ -125,10 +129,16 @@
 			JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex);
 
 			// 2銆侀《閮ㄨ疆鎾浘
-			List<SwiperPicture> topPicList = swiperPictureService.getByBannerCard("index_top");
-			if (topPicList == null) {
-				topPicList = new ArrayList<SwiperPicture>();
+			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
+			List<SwiperPicture> topPicList = new ArrayList<>();
+			if (oldtopPicList != null && oldtopPicList.size() > 0)
+				topPicList.addAll(oldtopPicList);
+			if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+				SwiperPicture notifyReName = swiperPictureService.selectByPrimaryKey(162L);
+				if (notifyReName != null)
+					topPicList.add(0, notifyReName);
 			}
+
 			root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList));
 
 			// 3銆侀個璇锋湁濂�
@@ -152,6 +162,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) {
@@ -273,16 +285,59 @@
 		Long endTime = nextTime.getTimeInMillis() - java.lang.System.currentTimeMillis();
 
 		JSONObject root = new JSONObject();
-		root.put("time", nextTime.getTimeInMillis());
-		root.put("endTime", endTime > 0 ? endTime : 0);
-		root.put("listgoods", array);
+		if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
+			root.put("time", nextTime.getTimeInMillis());
+			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.getTimeInMillis());
+			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);
+		}
 
+		return root;
+	}
+
+	/**
+	 * 閲戝竵鍏戞崲淇℃伅
+	 * 
+	 * @param acceptData
+	 * @return
+	 */
+	private JSONObject getScoreExchangeInfo(AcceptData acceptData) {
+
+		JSONObject root = new JSONObject();
+		JSONArray array = new JSONArray();
+		array.add(
+				"https://gw.alicdn.com/bao/uploaded/i2/72768346/O1CN01rwRcUH2BWW6oc01hd_!!0-item_pic.jpg_180x180xz.jpg_.webp");
+		array.add(
+				"https://gw.alicdn.com/bao/uploaded/i2/479184430/O1CN01HjEq4j1iaz7HbWeX9_!!479184430.jpg_180x180xz.jpg_.webp");
+		root.put("imgList", array);
 		JSONObject params = new JSONObject();
 		params.put("url", configService.get("spike_goods_link"));
 
 		root.put("params", params);
-		root.put("jumpDetail", jumpDetail);
+		root.put("jumpDetail", jumpDetailV2Service.getByTypeCache("web",
+				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;
 	}
 
@@ -347,6 +402,13 @@
 			List<TaoBaoGoodsBrief> goodsList = homeRecommendGoodsService.listGoodsByPage(null, acceptData.getDevice(),
 					imei, idfa, page);
 
+			if (page < 4) {// 鍓嶄笁椤靛姞鍏ユ洿鏂�
+				try {
+					taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList);
+				} catch (Exception e) {
+				}
+			}
+
 			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 			BigDecimal shareRate = hongBaoManageService.getShareRate();
 			for (TaoBaoGoodsBrief goods : goodsList) {

--
Gitblit v1.8.0