admin
2021-09-30 42411e4a26461229c6bca6e89ca55e98a80f5a4e
fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopApiUtil.java
@@ -40,6 +40,9 @@
    private final static String appKey = "f9e7f22f";
    private final static String appSecret = "9B2291352497FAF42B2DF44BFCF62316";
    //是否采用订单侠转链
    private final static boolean CONVERT_DINGDANXIA = true;
    /**
     * 获取签名
     *
@@ -209,6 +212,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);
@@ -216,6 +224,31 @@
        taskParams.put("chanTag", tag);
        taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID());
        String result = baseRequest("com.vip.adp.api.open.service.UnionUrlService", "genByGoodsId",
                JSONObject.fromObject(taskParams));
        System.out.println(result);
        JSONObject resultJSON = JSONObject.fromObject(result);
        if (resultJSON.optInt("returnCode") == 0) {
            String re = resultJSON.optJSONObject("result").optJSONArray("urlInfoList").optJSONObject(0).toString();
            return new Gson().fromJson(re, VIPConvertResultDTO.class);
        }
        return null;
    }
    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);
        taskParams.put("urlList", urlArray);
        if (tag != null) {
            taskParams.put("chanTag", tag);
        }
        taskParams.put("requestId", System.currentTimeMillis() + "_" + UUID.randomUUID());
        String result = baseRequest("com.vip.adp.api.open.service.UnionUrlService", "genByVIPUrl",
                JSONObject.fromObject(taskParams));
        System.out.println(result);
        JSONObject resultJSON = JSONObject.fromObject(result);
@@ -292,9 +325,7 @@
    }
    public static void main(String[] args) {
        convertLink("6919237495414585303","437032");
        convertLinkByUrl("https://t.vip.com/T7RyKKCJLj9", "437032");
    }
}