From 11f7b5339af12ae57f3c95cc7543bcb86f88053c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 23 一月 2019 11:24:20 +0800
Subject: [PATCH] Merge branch 'dev-msg'

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java |   52 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 44 insertions(+), 8 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 bef2c99..e357bdd 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
@@ -1463,25 +1463,41 @@
 
 	}
 
+	public static String getAccessToken(String code, String appKey, String appSecret) {
+		Map<String, String> map = new HashMap<>();
+		map.put("method", "taobao.top.auth.token.create");
+		map.put("code", code);
+		TaoKeAppInfo app = new TaoKeAppInfo();
+		app.setAppKey(appKey);
+		app.setAppSecret(appSecret);
+		try {
+			JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
+			if (json != null)
+				return json.toString();
+		} catch (TaoKeApiException e) {
+			e.printStackTrace();
+		}
+
+		return null;
+	}
+
 	/**
 	 * 娓犻亾閭�璇风爜
 	 * 
 	 * @param relationId
 	 * @return
 	 */
-	public static String getInviteCode(Long relationId, String accessToken) {
+	public static String getInviteCode(Long relationId, String accessToken, String appKey, String appSecret) {
 		Map<String, String> map = new HashMap<>();
 		map.put("method", "taobao.tbk.sc.invitecode.get");
 		map.put("session", accessToken);
-		map.put("relation_id", relationId + "");
-		map.put("code_type", "2");
-		map.put("relation_app", "杩斿埄鍒�");
+		map.put("code_type", "1");
+		map.put("relation_app", "common");
 		JSONObject resultJSON = null;
 		try {
-			TaoKeAppInfo app = new TaoKeAppInfo();
-			app.setAppKey("24567001");
-			app.setAppSecret("e26a8d0f8726883d44bf04742829b533");
-			app.setAdzoneId("123123");
+			TaoKeAppInfo app = new TaoKeAppInfo();
+			app.setAppKey(appKey);
+			app.setAppSecret(appSecret);
 			resultJSON = TaoKeBaseUtil.baseRequest(map, app);
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
@@ -1490,7 +1506,27 @@
 			return null;
 
 		return null;
+	}
 
+	public static String beiAnQuDao(Long relationId, String accessToken, String appKey, String appSecret) {
+		Map<String, String> map = new HashMap<>();
+		map.put("method", "taobao.tbk.sc.publisher.info.save");
+		map.put("session", accessToken);
+		map.put("inviter_code", "A2QnGL");
+		map.put("info_type", "1");
+		JSONObject resultJSON = null;
+		try {
+			TaoKeAppInfo app = new TaoKeAppInfo();
+			app.setAppKey(appKey);
+			app.setAppSecret(appSecret);
+			resultJSON = TaoKeBaseUtil.baseRequest(map, app);
+		} catch (TaoKeApiException e) {
+			e.printStackTrace();
+		}
+		if (resultJSON == null)
+			return null;
+
+		return null;
 	}
 
 	private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) {

--
Gitblit v1.8.0