From 62d6c26176a6aaac033dfb9e26fb3f691ef19a0a Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 01 八月 2019 15:45:51 +0800
Subject: [PATCH] 跳转拼多多原生APP兼容

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
index 0bb666b..1ecc0dc 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -17,6 +17,7 @@
 import com.yeshi.fanli.dto.jd.JDCouponInfo;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
+import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
 import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.bus.user.ShamUser;
@@ -583,8 +584,7 @@
 		if (couponInfo != null) {
 			// 鍒搁摼鎺ュ鐞�
 			String materialId = "https://item.jd.com/" + id + ".html";
-			String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "",
-					null);
+			String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", null);
 			couponInfo.setLink(url);
 		}
 
@@ -715,9 +715,11 @@
 		BigDecimal shareRate = hongBaoManageService.getShareRate();
 		GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate);
 		CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
+		PDDPromotionUrl convertUrl = null;
 		if (couponInfo != null) {
-			String url = PinDuoDuoApiUtil.getPromotionUrl(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
-			couponInfo.setLink(url);
+			convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
+			if (convertUrl != null)
+				couponInfo.setLink(convertUrl.getShortUrl());
 		}
 
 		ShopInfoVO shopInfo = goodsDetail.getShopInfo();
@@ -776,12 +778,7 @@
 			extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_PDD));
 		}
 
-		// 娴嬭瘯
-		SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system,
-				"goods_detail_jump_taobao");
-		if ("1".equalsIgnoreCase((params.getValue() + "").trim())) {
-			extraVO.setIsNative(true);
-		}
+		extraVO.setIsNative(true);
 
 		// 鍒嗕韩璺緞
 		String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
@@ -803,6 +800,11 @@
 		ShareVO shareInfoVO = new ShareVO();
 		shareInfoVO.setHelpLink(helpLink);
 		extraVO.setShare(shareInfoVO);
+
+		if (convertUrl != null) {
+			extraVO.setCouponJumpLink(convertUrl.getShortUrl());
+			extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
+		}
 
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1060,10 +1062,11 @@
 			return;
 		}
 
-		String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
+		PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_FANLI + "", uid + "");
 		JSONObject data = new JSONObject();
 		data.put("native", true);
-		data.put("jumpLink", jumpLink);
+		data.put("jumpLink", convertUrl.getShortUrl());
+		data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 

--
Gitblit v1.8.0