From a7454d8a6325566753358b37ffabfae2faa0ca7f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 28 四月 2021 19:46:49 +0800
Subject: [PATCH] 拼多多授权调整,支持小程序跳转

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
index 891119e..9d61096 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -556,7 +556,7 @@
                     couponUrl = couponInfo.getLink();
                 }
                 String materialId = "https://item.jd.com/" + goodsId + ".html";
-                String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl,
+                String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null,
                         JDApiUtil.POSITION_SHARE + "", "1");
                 String template = configService.getValue(ConfigKeyEnum.quickShareJDCommentText.getKey(), system);
                 if (jumpLink == null) {
@@ -564,7 +564,8 @@
                 }
                 commentText = template.replace("[閾炬帴]", jumpLink);
             } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
-                String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsId), PinDuoDuoApiUtil.PID_SHARE + "", "1");
+                PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId), PinDuoDuoApiUtil.PID_SHARE + "", "1");
+                String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsDetail.getGoodsSign(), PinDuoDuoApiUtil.PID_SHARE + "", "1");
                 if (jumpLink == null) {
                     throw new GoodsEvaluateException(1, "璇ュ晢鍝佽浆閾惧け璐�");
                 }
@@ -624,12 +625,15 @@
                 couponUrl = couponInfo.getLink();
             }
             String materialId = "https://item.jd.com/" + goodsDetailVO.getGoodsId() + ".html";
-            String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "",
+            String jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_SHARE + "",
                     "1");
             String template = configService.getValue(ConfigKeyEnum.quickShareJDCommentText.getKey(), system);
             commentText = template.replace("[閾炬帴]", jumpLink);
         } else if (goodsDetailVO.getGoodsType() == Constant.SOURCE_TYPE_PDD) {
-            String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(Long.parseLong(goodsDetailVO.getGoodsId()),
+            PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsDetailVO.getGoodsId()),
+                    PinDuoDuoApiUtil.PID_SHARE + "", "1");
+
+            String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsDetail.getGoodsSign(),
                     PinDuoDuoApiUtil.PID_SHARE + "", "1");
             String template = configService.getValue(ConfigKeyEnum.quickSharePDDCommentText.getKey(), system);
             commentText = template.replace("[閾炬帴]", jumpLink);
@@ -907,7 +911,7 @@
                 }
             } else if (i == 0 && kind == 1) {
                 try {
-                    convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true);
+                    convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true, false);
                 } catch (Exception e) {
                     throw new GoodsEvaluateException(1, "涓嶅寘鍚彲杞摼鐨勫彛浠や笌閾炬帴");
                 }
@@ -977,7 +981,7 @@
         String content = commentInfo.getContent();
         if (!StringUtil.isNullOrEmpty(content) && commentInfo.getNeedSpin()) {
             try {
-                convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true);
+                convertLinkManager.convertLinkFromText(content, Constant.LINK_TOKEN_VERIFY_UID, true, false);
             } catch (ConvertLinkExceptionException e) {
                 if (ConvertLinkExceptionException.CODE_NONE != e.getCode()) {
                     throw new GoodsEvaluateException(1, "鍖呭惈涓嶅彲杞摼鐨勫彛浠や笌閾炬帴");
@@ -1700,7 +1704,7 @@
                                 List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content);
                                 for (String st : activityIdList)
                                     content = content.replace(st, "");
-
+                                content = content.replace("{relationId}", "");
                                 commentInfoNew.setContent(content);
                             }
                         }
@@ -1711,6 +1715,8 @@
                         List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(content);
                         for (String st : activityIdList)
                             content = content.replace(st, "");
+                        content = content.replace("{relationId}", "");
+
                         commentInfoNew.setContent(content);
                     }
 

--
Gitblit v1.8.0