From 70ebe043e6b62756be9e257fe954c747d46568b9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 16 九月 2022 19:00:59 +0800 Subject: [PATCH] 商品ID字符串化 --- fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 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 4441c0f..11a228f 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 @@ -116,7 +116,7 @@ public static TaoBaoGoodsBrief getSimpleGoodsInfo(String id) throws TaobaoGoodsDownException { Map<String, String> map = new HashMap<>(); //TODO 涓存椂鎺ュ彛 taobao.tbk.item.info.get - map.put("method", "taobao.tbk.item.info.temporary.get"); + map.put("method", "taobao.tbk.item.info.get"); map.put("num_iids", id + ""); String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); System.out.println(resultStr); @@ -128,9 +128,9 @@ } //TODO 淇敼涓存椂鎺ュ彛 tbk_item_info_get_response - if (data.optJSONObject("tbk_item_info_temporary_get_response") == null) + if (data.optJSONObject("tbk_item_info_get_response") == null) return null; - JSONArray array = data.optJSONObject("tbk_item_info_temporary_get_response").optJSONObject("results") + JSONArray array = data.optJSONObject("tbk_item_info_get_response").optJSONObject("results") .optJSONArray("n_tbk_item"); if (array != null && array.size() > 0) { JSONObject item = array.optJSONObject(0); @@ -642,7 +642,7 @@ TaoBaoSearchResult taoBaoSearchResult = new TaoBaoSearchResult(); Map<String, String> map = new HashMap<>(); //TODO 涓存椂鎺ュ彛taobao.tbk.dg.material.optional - map.put("method", "taobao.tbk.dg.material.temporary.optional"); + map.put("method", "taobao.tbk.dg.material.optional"); map.put("page_size", filter.getPageSize() == 0 ? "20" : filter.getPageSize() + ""); map.put("page_no", (filter.getPage() <= 0 ? 1 : filter.getPage()) + ""); if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId)) { @@ -759,9 +759,9 @@ System.out.println("resultStr"+ resultStr); JSONObject data = JSONObject.fromObject(resultStr); //TODO 涓存椂鎺ュ彛tbk_dg_material_optional_response - if (data.optJSONObject("tbk_dg_material_temporary_optional_response") != null - && data.optJSONObject("tbk_dg_material_temporary_optional_response").optJSONObject("result_list") != null) { - JSONArray array = data.optJSONObject("tbk_dg_material_temporary_optional_response").optJSONObject("result_list") + if (data.optJSONObject("tbk_dg_material_optional_response") != null + && data.optJSONObject("tbk_dg_material_optional_response").optJSONObject("result_list") != null) { + JSONArray array = data.optJSONObject("tbk_dg_material_optional_response").optJSONObject("result_list") .optJSONArray("map_data"); List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); if (array != null) { @@ -773,7 +773,7 @@ } taoBaoSearchResult.setTaoBaoGoodsBriefs(goodsList); - JSONObject optJSONObject = data.optJSONObject("tbk_dg_material_temporary_optional_response"); + JSONObject optJSONObject = data.optJSONObject("tbk_dg_material_optional_response"); int totalResults = optJSONObject.getInt("total_results"); int totalPage = totalResults % pageEntity.getPageSize() == 0 ? totalResults / pageEntity.getPageSize() : totalResults / pageEntity.getPageSize() + 1; @@ -838,7 +838,7 @@ TaoBaoSearchResult taoBaoSearchResult = new TaoBaoSearchResult(); Map<String, String> map = new HashMap<>(); //TODO 涓存椂鎺ュ彛 taobao.tbk.dg.material.optional - map.put("method", "taobao.tbk.dg.material.temporary.optional"); + map.put("method", "taobao.tbk.dg.material.optional"); map.put("page_size", 50 + ""); map.put("page_no", 1 + ""); map.put("start_price", (int) zkPrice.subtract(new BigDecimal(1)).doubleValue() + ""); @@ -859,9 +859,9 @@ System.out.println(resultStr); JSONObject data = JSONObject.fromObject(resultStr); //TODO 涓存椂鎺ュ彛 tbk_dg_material_optional_response - if (data.optJSONObject("tbk_dg_material_temporary_optional_response") != null - && data.optJSONObject("tbk_dg_material_temporary_optional_response").optJSONObject("result_list") != null) { - JSONArray array = data.optJSONObject("tbk_dg_material_temporary_optional_response").optJSONObject("result_list") + if (data.optJSONObject("tbk_dg_material_optional_response") != null + && data.optJSONObject("tbk_dg_material_optional_response").optJSONObject("result_list") != null) { + JSONArray array = data.optJSONObject("tbk_dg_material_optional_response").optJSONObject("result_list") .optJSONArray("map_data"); List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); if (array != null) { @@ -2284,7 +2284,7 @@ public static void main(String[] args) throws TaobaoGoodsDownException { //鎼滅储 - TaoBaoGoodsBrief goods= searchGoodsDetail("X4g0DS2OK34iwyyI06AQQCg-XQWo4eH00jgRjx3iB0"); + TaoBaoGoodsBrief goods= searchGoodsDetail("682141395159"); System.out.println(goods); -- Gitblit v1.8.0