From 34e65d72e73acab040b68d01ef6b4764b4408624 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 05 八月 2019 10:07:38 +0800
Subject: [PATCH] 修改推荐记录点击详情跳转方式不对的bug
---
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java | 49 ++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 42 insertions(+), 7 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 6c70940..d9b5e46 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
@@ -22,6 +22,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
+import com.yeshi.fanli.exception.taobao.TaoBaoAuthException;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
@@ -1646,7 +1647,7 @@
return null;
}
- public static String getRelationId(String accessToken, String appKey, String appSecret) {
+ public static String getRelationId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
Map<String, String> map = new HashMap<>();
map.put("method", "taobao.tbk.sc.publisher.info.save");
map.put("session", accessToken);
@@ -1662,14 +1663,22 @@
return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
.optString("relation_id");
} catch (TaoKeApiException e) {
- e.printStackTrace();
- LogHelper.error("娓犻亾ID鐢宠鍑洪敊:" + e.getMsg());
+ JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
+ if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 鏈疄鍚�
+ {
+ throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
+ } else {
+ e.printStackTrace();
+ 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) {
+ public static String getSpecialId(String accessToken, String appKey, String appSecret) throws TaoBaoAuthException {
Map<String, String> map = new HashMap<>();
map.put("method", "taobao.tbk.sc.publisher.info.save");
map.put("session", accessToken);
@@ -1685,8 +1694,17 @@
return resultJSON.optJSONObject("tbk_sc_publisher_info_save_response").optJSONObject("data")
.optString("special_id");
} catch (TaoKeApiException e) {
- e.printStackTrace();
- LogHelper.error("浼氬憳杩愯惀ID鐢宠鍑洪敊:" + resultJSON);
+ JSONObject errorJSON = JSONObject.fromObject(e.getMsg()).optJSONObject("error_response");
+ if (errorJSON.optInt("code") == 15 && errorJSON.optInt("sub_code") == 1)// 鏈疄鍚�
+ {
+ throw new TaoBaoAuthException(TaoBaoAuthException.CODE_NOT_REAL_NAME, errorJSON.optString("sub_msg"));
+ } else {
+ e.printStackTrace();
+ 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;
@@ -2082,6 +2100,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