From 35c25585cf6fea9e29574a75a03c57381cbe19e1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 05 八月 2019 16:35:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/div' into div

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java |   99 ++++++++++++-------------------------------------
 1 files changed, 25 insertions(+), 74 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
index c82ffa5..e7aeb14 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -39,45 +39,7 @@
 //娣樺疂瀹PI鎺ュ彛
 public class TaoKeApiUtil {
 
-	/**
-	 * 鎸夊叧閿瓧鍜屽垎绫绘悳绱㈠埜
-	 * 
-	 * @param key
-	 * @param catList
-	 * @return
-	 */
-	public static TaoBaoSearchResult searchCouple(String key, List<Long> catList, int page, int pageSize) {
-		Map<String, String> map = new HashMap<>();
-		map.put("method", "taobao.tbk.dg.item.coupon.get");
-		map.put("page_size", pageSize + "");
-		map.put("page_no", page + "");
-		String cate = "";
-		if (catList != null && catList.size() > 10)
-			catList = catList.subList(0, 10);
-		if (catList != null && catList.size() > 0) {
-			for (Long c : catList)
-				cate += c + ",";
-			if (cate.endsWith(","))
-				cate = cate.substring(0, cate.length() - 1);
-			map.put("cat", cate);
-		}
-
-		if (!StringUtil.isNullOrEmpty(key)) {
-			map.put("q", key);
-		}
-		String result = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
-		System.out.println(result);
-		TaoBaoSearchResult finalResult = parseCoupleContent(result);
-		if (finalResult == null)
-			return null;
-		PageEntity pageEntity = finalResult.getPageEntity();
-		pageEntity.setPageIndex(page);
-		pageEntity.setPageSize(pageSize);
-		pageEntity.setTotalPage(pageEntity.getTotalCount() % pageSize == 0
-				? ((int) (pageEntity.getTotalCount() / pageSize)) : (int) (pageEntity.getTotalCount() / pageSize + 1));
-		finalResult.setPageEntity(pageEntity);
-		return finalResult;
-	}
+	
 
 	// 瑙f瀽鍒哥殑鍐呭
 	private static TaoBaoSearchResult parseCoupleContent(String content) {
@@ -1298,41 +1260,6 @@
 	}
 
 	/**
-	 * TODO 鎸夎澶囩寽浣犲枩娆�
-	 * 
-	 * @param userNickName
-	 * @param os
-	 * @param imei
-	 * @param idfa
-	 * @param ip
-	 * @param ua
-	 * @param net
-	 * @param pageNo
-	 * @param pageSize
-	 */
-	public static void guessLikeByDevice(String userNickName, String os, String imei, String idfa, String ip, String ua,
-			String net, int pageNo, int pageSize) {
-		Map<String, String> map = new HashMap<>();
-		map.put("method", "taobao.tbk.item.guess.like");
-		if (!StringUtil.isNullOrEmpty(userNickName))
-			map.put("user_nick", userNickName);
-		map.put("os", os + "");
-		if (!StringUtil.isNullOrEmpty(idfa))
-			map.put("idfa", idfa);
-		if (!StringUtil.isNullOrEmpty(imei)) {
-			map.put("imei", imei + "");
-			map.put("imei_md5", StringUtil.Md5(imei));
-		}
-		map.put("ip", ip + "");
-		map.put("ua", ua + "");
-		map.put("net", net + "");
-		map.put("page_no", pageNo + "");
-		map.put("page_size", pageSize + "");
-		String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
-		System.out.println(resultStr);
-	}
-
-	/**
 	 * 鍝佺墝鍒歌幏鍙�
 	 * 
 	 * @param pageNo
@@ -1672,7 +1599,10 @@
 				LogHelper.error("娓犻亾ID鐢宠鍑洪敊:" + e.getMsg());
 				throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
 			}
+		} catch (Exception e) {
+			LogHelper.error("娓犻亾ID鐢宠鍑洪敊:" + (resultJSON != null ? resultJSON.toString() : "鏈煡閿欒"));
 		}
+		return null;
 	}
 
 	public static String getSpecialId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
@@ -1700,7 +1630,11 @@
 				LogHelper.error("浼氬憳杩愯惀ID鐢宠鍑洪敊:" + e.getMsg());
 				throw new TaoBaoAuthException(TaoBaoAuthException.CODE_OTHER, errorJSON.optString("sub_msg"));
 			}
+		} catch (Exception e) {
+			LogHelper.error("浼氬憳杩愯惀ID鐢宠鍑洪敊:" + (resultJSON != null ? resultJSON.toString() : "鏈煡閿欒"));
 		}
+
+		return null;
 	}
 
 	public static void specialConvertItem(Long auctionId, TaoKeAppInfo app) {
@@ -2093,6 +2027,23 @@
 		}
 		return null;
 	}
+
+	public static void getCouponByAuctionId(Long auctionId) {
+		Map<String, String> map = new HashMap<>();
+		map.put("method", "taobao.tbk.itemid.coupon.get");
+		map.put("platform", 2 + "");
+		map.put("pid", TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
+		map.put("num_iids", auctionId + "");
+		TaoKeAppInfo app = new TaoKeAppInfo();
+		app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
+		app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
+		try {
+			JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
+			System.out.print(json);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
 }
 
 class QuanInfo {

--
Gitblit v1.8.0