From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java
index 8b296ee..4e5334f 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java
@@ -268,7 +268,7 @@
      * @param out
      */
     @RequestMapping(value = "getGoodsDetial")
-    public void getGoodsDetial(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Long uid,
+    public void getGoodsDetial(WXMPAcceptData acceptData, String goodsId, Integer goodsType, String from, Long uid,
                                PrintWriter out) {
         if (goodsType == null || goodsType < 2 || goodsType > 3) {
             out.print(JsonUtil.loadFalseResult(1, "璇蜂紶閫掓纭钩鍙板弬鏁�"));
@@ -283,7 +283,7 @@
 
         /*-------- 鎷煎澶氬晢鍝�  -------*/
         if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
-            getDetialPDD(acceptData, goodsId, uid, from, out);
+            getDetialPDD(acceptData, Long.parseLong(goodsId), uid, from, out);
             return;
         }
     }
@@ -297,10 +297,10 @@
      * @param from
      * @param out
      */
-    private void getDetialJD(WXMPAcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
+    private void getDetialJD(WXMPAcceptData acceptData, String id, Long uid, String from, PrintWriter out) {
         JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 楂樼骇鎺ュ彛
         if (jdGoods == null) {
-            jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉
+//            jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉
             // jdGoods = JDApiUtil.getGoodsDetail(id); // 鏅�氭帴鍙�
         }
 
@@ -374,8 +374,13 @@
         if (couponInfo != null) {
             // 鍒搁摼鎺ュ鐞�
             String materialId = "https://item.jd.com/" + id + ".html";
-            String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
-                    null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon), null);
+            String url = null;
+            try {
+                url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
+                        null, pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.coupon), null);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
             couponInfo.setLink(url);
         }
 
@@ -414,7 +419,7 @@
         extraVO.setListShareUser(listShareUser);
 
         // 棰嗗埜浜哄垪琛�
-        List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
+        List<ShamUser> listCouponUser = new ArrayList<>();
         if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 1000) {
             listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
         }
@@ -422,7 +427,7 @@
 
         if (uid != null) {
             // 鏄惁鍔犲叆鏀惰棌
-            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
+            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id+"",
                     Constant.SOURCE_TYPE_JD);
             extraVO.setCollected(collectionGoods != null ? true : false);
         }
@@ -568,7 +573,7 @@
 
         if (uid != null) {
             // 鏄惁鍔犲叆鏀惰棌
-            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
+            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id+"",
                     Constant.SOURCE_TYPE_PDD);
             extraVO.setCollected(collectionGoods != null ? true : false);
         }
@@ -727,7 +732,7 @@
      * @param out
      */
     @RequestMapping(value = "getBuyLink", method = RequestMethod.POST)
-    public void getBuyLink(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, String couponUrl,
+    public void getBuyLink(WXMPAcceptData acceptData, String goodsId, Integer goodsType, String from, String couponUrl,
                            Long uid, String inviteCode, PrintWriter out) {
         if (goodsId == null || goodsType == null) {
             out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧淇℃伅浼犻�掗敊璇�"));
@@ -777,7 +782,12 @@
             if (share) {
                 position = Long.parseLong(pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_JD, SystemPIDInfo.PidType.share));
             }
-            String jdLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, position + "", subUnionId);
+            String jdLink = null;
+            try {
+                jdLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, position + "", subUnionId);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
             try {
                 jumpLink = "/pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jdLink, "UTF-8");
             } catch (Exception e) {
@@ -823,7 +833,7 @@
      * @param out
      */
     @RequestMapping(value = "sharePoster", method = RequestMethod.POST)
-    public void sharePoster(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
+    public void sharePoster(WXMPAcceptData acceptData, String goodsId, Integer goodsType, String from, Integer type,
                             Long uid, PrintWriter out) {
         if (uid == null || uid < 1) {
             out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
@@ -864,7 +874,7 @@
     /**
      * 鍒涘缓浜笢鍒嗕韩娴锋姤
      */
-    private void createPosterJD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
+    private void createPosterJD(WXMPAcceptData acceptData, String goodsId, Integer goodsType, String from, Integer type,
                                 UserInfo user, String inviteCode, PrintWriter out) {
         JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
         if (jdGoods == null) {
@@ -910,7 +920,7 @@
                 history.setTkCode(null);
                 history.setLink(null);
                 history.setQuanLink(null);
-                history.setGoodsId(goodsId);
+                history.setGoodsId(goodsId+"");
                 history.setPostPicture(goods.getPicUrl());
                 history.setPictures(JsonUtil.getGson().toJson(goods.getImgList()));
                 history.setShareImg(posterLink);
@@ -922,7 +932,7 @@
     /**
      * 鍒涘缓鎷煎澶氬垎浜捣鎶�
      */
-    private void createPosterPDD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
+    private void createPosterPDD(WXMPAcceptData acceptData, String goodsId, Integer goodsType, String from, Integer type,
                                  UserInfo user, String inviteCode, PrintWriter out) {
         PDDGoodsDetail pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
         if (pddGoods == null) {
@@ -969,7 +979,7 @@
                 history.setTkCode(null);
                 history.setLink(null);
                 history.setQuanLink(null);
-                history.setGoodsId(goodsId);
+                history.setGoodsId(goodsId+"");
                 history.setPostPicture(goods.getPicUrl());
                 history.setPictures(JsonUtil.getGson().toJson(goods.getImgList()));
                 history.setShareImg(posterLink);

--
Gitblit v1.8.0