From 5e7b0ed4a154ad067cbcf4aa1a1c7cce32f9864c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 26 四月 2024 18:02:17 +0800
Subject: [PATCH] 唯品会链接解析升级

---
 fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java |   58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java
index b199908..333d349 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java
@@ -4,14 +4,9 @@
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.Type;
 import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
 
+import com.yeshi.fanli.util.Constant;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
 import org.apache.commons.httpclient.methods.PostMethod;
@@ -32,7 +27,7 @@
 
 /**
  * TODO 鏈畬鎴� 鍞搧浼氭帴鍙�
- *
+ * 鍟嗗搧鎺ュ彛閾炬帴锛歨ttps://vop.vip.com/home#/api/method/detail/com.vip.adp.api.open.service.UnionGoodsService-1.3.0/getByGoodsIds
  * @author Administrator
  */
 public class VipShopApiUtil {
@@ -40,10 +35,14 @@
     private final static String appKey = "f9e7f22f";
     private final static String appSecret = "9B2291352497FAF42B2DF44BFCF62316";
 
+    //鏄惁閲囩敤璁㈠崟渚犺浆閾�
+    private final static boolean CONVERT_DINGDANXIA = true;
+
     /**
      * 鑾峰彇绛惧悕
      *
-     * @param params
+     * @param systemParams
+     * @param taskParams
      * @return
      */
     private static String getSign(Map<String, String> systemParams, JSONObject taskParams) {
@@ -144,6 +143,14 @@
         if (searchFilter.getFieldName() != null)
             taskParams.put("fieldName", searchFilter.getFieldName() + "");
 
+        //鏂板鍙傛暟
+        taskParams.put("chanTag", "default_pid");
+        taskParams.put("openId", "default_open_id");
+        taskParams.put("realCall", "true");
+
+
+
+
         JSONObject root = new JSONObject();
         root.put("request", JSONObject.fromObject(taskParams));
         String result = baseRequest("com.vip.adp.api.open.service.UnionGoodsService", "query", root);
@@ -181,6 +188,11 @@
         taskParams.put("pageSize", 20 + "");
         taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID());
 
+        //鏂板鍙傛暟
+        taskParams.put("chanTag", "default_pid");
+        taskParams.put("openId", "default_open_id");
+        taskParams.put("realCall", "true");
+
 
         JSONObject root = new JSONObject();
         root.put("request", JSONObject.fromObject(taskParams));
@@ -209,6 +221,11 @@
      * @param goodsId
      */
     public static VIPConvertResultDTO convertLink(String goodsId, String tag) {
+
+        if (CONVERT_DINGDANXIA) {
+            return DingDanXiaApiUtil.convertLink(goodsId, tag);
+        }
+
         JSONObject taskParams = new JSONObject();
         JSONArray goodsIdArray = new JSONArray();
         goodsIdArray.add(goodsId);
@@ -228,6 +245,10 @@
 
 
     public static VIPConvertResultDTO convertLinkByUrl(String url, String tag) {
+
+        if (CONVERT_DINGDANXIA) {
+            return DingDanXiaApiUtil.convertLinkByUrl(url, tag);
+        }
         JSONObject taskParams = new JSONObject();
         JSONArray urlArray = new JSONArray();
         urlArray.add(url);
@@ -257,6 +278,13 @@
         JSONObject params = new JSONObject();
         params.put("goodsIdList", goodsIdList);
         params.put("requestId", UUID.randomUUID());
+        //鏂板鍙傛暟
+        params.put("chanTag", "default_pid");
+        JSONObject request = new JSONObject();
+        request.put("openId", "default_open_id");
+        request.put("realCall", "true");
+        params.put("request", request);
+
         String result = baseRequest("com.vip.adp.api.open.service.UnionGoodsService", "getByGoodsIds",
                 JSONObject.fromObject(params));
         System.out.println(result);
@@ -313,7 +341,17 @@
     }
 
     public static void main(String[] args) {
-        convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032");
+//        VIPSearchFilter sf=new VIPSearchFilter();
+//        sf.setKeyword("鑺卞崏");
+//        sf.setPage(1);
+//        sf.setPageSize(Constant.PAGE_SIZE);
+//        search(sf);
+
+        getGoodsDetail("6920553939593155215");
+
+//        convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032");
+//        convertLink("560392904","437032");
+//        getOrderList(VipShopOrderQueryModel.createOrderSn(Arrays.asList(new String[]{"23090254293903"}),1));
     }
 
 }

--
Gitblit v1.8.0