From 24587fd1b4af52469d1e122d2a495eea79d6865e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 24 七月 2023 14:39:30 +0800 Subject: [PATCH] 淘客返利场景修复 --- fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 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 639ff93..626095a 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 @@ -26,6 +26,7 @@ import net.sf.json.JSONObject; import org.yeshi.utils.JsonUtil; import org.yeshi.utils.MoneyBigDecimalUtil; +import org.yeshi.utils.NumberUtil; import org.yeshi.utils.TimeUtil; import org.yeshi.utils.taobao.TbImgUtil; @@ -116,11 +117,17 @@ */ 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.get"); -// map.put("biz_scene_id", 2 + ""); + map.put("num_iids", id + ""); - String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); + String resultStr = null; + if(!NumberUtil.isNumeric(id)){ + resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); + }else{ + map.put("biz_scene_id", "2"); + resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, TaoBaoConstant.getSpecialAuthAppInfo(TaoBaoConstant.TAOBAO_PID_DEFAULT)); + } System.out.println(resultStr); JSONObject data = JSONObject.fromObject(resultStr); // 鍟嗗搧涓嬫灦 @@ -137,7 +144,7 @@ if (array != null && array.size() > 0) { JSONObject item = array.optJSONObject(0); TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item); - if(goods!=null){ + if(goods!=null&&!NumberUtil.isNumeric(id)){ goods.setAuctionId(id); } return goods; @@ -647,7 +654,6 @@ PageEntity pageEntity = new PageEntity(); TaoBaoSearchResult taoBaoSearchResult = new TaoBaoSearchResult(); Map<String, String> map = new HashMap<>(); - //TODO 涓存椂鎺ュ彛taobao.tbk.dg.material.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()) + ""); @@ -2294,8 +2300,23 @@ } public static void main(String[] args) throws TaoBaoTokenParseException, TaobaoGoodsDownException { - TaoBaoGoodsBrief goods = getSimpleGoodsInfo("qYtrU8tgk7CWt0-GmgDAKHqqGm3XDwHZj"); - System.out.println(goods.getAuctionId()); +// SearchFilter sf =new SearchFilter(); +// sf.setKey("https://s.click.taobao.com/HCsB7Du"); +// sf.setPageSize(10); +// sf.setPage(1); +// searchWuLiao(sf,null,null); +// tokenConvert("銆愭窐瀹濄�慼ttps://m.tb.cn/h.5YFsc7F?tk=A8wSdGRxsjm CZ0001 銆屼縿缃楁柉椋庡懗杩蜂綘鎻愭媺绫宠嫃铚傝湝濂舵补鍗冨眰鐢滃搧铔嬬硶鏃╅鏁寸3000鍏嬮浂椋熴�峔n" + +// "鐐瑰嚮閾炬帴鐩存帴鎵撳紑 鎴栬�� 娣樺疂鎼滅储鐩存帴鎵撳紑"); + + TaoBaoGoodsBrief goods = getSimpleGoodsInfo("666444715990"); + System.out.println(goods); +// System.out.println(goods.getAuctionId()); +// Map<String, String> map = new HashMap<>(); +// map.put("method", "taobao.tbk.item.info.get"); +// map.put("biz_scene_id", "2"); +// map.put("num_iids", "708395859317"); +// String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); +// System.out.println(resultStr); } } -- Gitblit v1.8.0