From 3e4ef41ffacd7f5fda2e81c3810cd11a6375b83c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 15 六月 2020 16:32:35 +0800
Subject: [PATCH] 好单库转链支持

---
 fanli/src/main/java/com/yeshi/fanli/service/manger/goods/ConvertLinkManager.java |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/manger/goods/ConvertLinkManager.java b/fanli/src/main/java/com/yeshi/fanli/service/manger/goods/ConvertLinkManager.java
index 04a00a9..1f941c8 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/manger/goods/ConvertLinkManager.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/manger/goods/ConvertLinkManager.java
@@ -15,6 +15,7 @@
 import org.yeshi.utils.StringUtil;
 
 import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
+import com.yeshi.fanli.dto.taobao.api.TaoKeOfficialActivityConvertResultDTO;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
 import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException;
@@ -28,6 +29,7 @@
 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.HaoDanKuApiUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
 
@@ -173,16 +175,18 @@
 					throw new Exception("鍟嗗搧淇℃伅鑾峰彇澶辫触");
 				String link = null;
 				if (share) {
-					TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId,
-							new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
-									TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT));
-					if (goods == null)
-						throw new Exception("鍟嗗搧杞摼澶辫触");
-
-					link = goods.getCouponLink();
-					if (StringUtil.isNullOrEmpty(link)) {
-						link = goods.getAuctionUrl();
-					}
+					//鏆傛椂璋冪敤濂藉崟搴揂PI
+					 link=HaoDanKuApiUtil.getInstance().convertLink(auctionId, TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT, null);
+//					TaoBaoGoodsBrief goods =  TaoKeApiUtil.specialConvertCoupon(auctionId,
+//							new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET,
+//									TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT));
+//					if (goods == null)
+//						throw new Exception("鍟嗗搧杞摼澶辫触");
+//
+//					link = goods.getCouponLink();
+//					if (StringUtil.isNullOrEmpty(link)) {
+//						link = goods.getAuctionUrl();
+//					}
 					if (StringUtil.isNullOrEmpty(link))
 						throw new Exception("鍟嗗搧杞摼澶辫触");
 					link += "&relationId=" + relationId;
@@ -250,7 +254,13 @@
 				String activityid = st.replace("{娣樺疂娲诲姩:", "").replace("}", "");
 				if (!StringUtil.isNullOrEmpty(activityid)) {
 					String adzoneId = TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3];
-					String link = TaoKeApiUtil.officialActivityConvert(adzoneId, activityid, relationId);
+					TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert(adzoneId,
+							activityid, relationId);
+					String link = dto.getShort_click_url();
+					if (StringUtil.isNullOrEmpty(link)) {
+						link = dto.getClick_url();
+					}
+
 					String token = TaoKeApiUtil.getTKToken("http://", "娣樺疂瀹樻柟娲诲姩", link);
 					newText = newText.replace(st, TaoBaoUtil.filterTaoToken(token));
 				}

--
Gitblit v1.8.0