From ec60e757d358636dcac1589c44a66f3e276fe58c Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 29 六月 2020 14:41:42 +0800
Subject: [PATCH] 拉新

---
 fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
index c127299..e132364 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/pinduoduo/PinDuoDuoApiUtil.java
@@ -80,6 +80,7 @@
 	 * @return
 	 */
 	public static PDDGoodsResult searchGoods(PDDSearchFilter sf) {
+		Gson gson = new GsonBuilder().disableHtmlEscaping().create();
 		Map<String, String> map = new HashMap<>();
 		map.put("type", "pdd.ddk.goods.search");
 		if (sf.getOptId() != null)
@@ -102,6 +103,11 @@
 			map.put("goods_id_list", "[" + StringUtil.concat(sf.getGoodsIdList(), ",") + "]");
 		if (sf.getMerchantType() != null)
 			map.put("merchant_type", sf.getMerchantType() + "");
+		
+		if (sf.getRangeList() != null && sf.getRangeList().size() > 0) {
+			map.put("range_list",gson.toJson(sf.getRangeList()).toString());
+		}
+		
 		map.put("pid", PID_FANLI);
 		String result = baseRequest(map);
 		JSONObject json = JSONObject.fromObject(result);
@@ -118,7 +124,6 @@
 		Type type = new TypeToken<List<PDDGoodsDetail>>() {
 		}.getType();
 
-		Gson gson = new GsonBuilder().disableHtmlEscaping().create();
 		List<PDDGoodsDetail> goodsList = gson.fromJson(array.toString(), type);
 		int totalCount = root.optInt("total_count");
 		return new PDDGoodsResult(totalCount, goodsList);
@@ -278,6 +283,7 @@
 		map.put("p_id", pid);
 		map.put("multi_group", "true");
 		map.put("generate_weapp_webview", "true");
+
 		// map.put("generate_weiboapp_webview", "true");
 		JSONArray array = new JSONArray();
 		array.add(goodsId);
@@ -303,6 +309,39 @@
 	}
 
 	/**
+	 * 寰俊灏忕▼搴忚浆閾� @Title: convertWXMP @Description: @param goodsId @param
+	 * pid @param customParams @return PDDPromotionUrl 杩斿洖绫诲瀷 @throws
+	 */
+	public static String convertWXMP(Long goodsId, String pid, String customParams) {
+		Map<String, String> map = new HashMap<>();
+		map.put("type", "pdd.ddk.goods.promotion.url.generate");
+		map.put("p_id", pid);
+		map.put("multi_group", "true");
+		map.put("generate_we_app", "true");
+
+		JSONArray array = new JSONArray();
+		array.add(goodsId);
+		map.put("goods_id_list", array.toString());
+		if (!StringUtil.isNullOrEmpty(customParams)) {
+			map.put("custom_parameters", customParams);
+		}
+
+		String result = baseRequest(map);
+		JSONObject root = JSONObject.fromObject(result);
+		JSONObject json = root.optJSONObject("goods_promotion_url_generate_response");
+		if (json == null) {
+			return null;
+		}
+		JSONArray resultArray = json.optJSONArray("goods_promotion_url_list");
+		if (resultArray != null && resultArray.size() > 0) {
+			JSONObject weApp = resultArray.optJSONObject(0).optJSONObject("we_app_info");
+			if (weApp != null)
+				return weApp.optString("page_path");
+		}
+		return null;
+	}
+
+	/**
 	 * 鍟嗗搧杞摼
 	 * 
 	 * @param goodsId

--
Gitblit v1.8.0