From 6f14a131b39c8fc44b29b6130c4e2002bbf2d3ca Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期日, 29 九月 2019 14:51:23 +0800 Subject: [PATCH] 返利奖励券H5接口增加 --- fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java | 57 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 15 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 6cb1728..d9be144 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 @@ -127,7 +127,7 @@ map.put("method", "taobao.tbk.item.info.get"); map.put("num_iids", id + ""); String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); - // System.out.println(resultStr); + System.out.println(resultStr); JSONObject data = JSONObject.fromObject(resultStr); // 鍟嗗搧涓嬫灦 if (data.optJSONObject("error_response") != null && data.optJSONObject("error_response").optInt("code") == 15 @@ -190,9 +190,15 @@ if (item.optBoolean("free_shipment")) goods.setFreeShipment(1); - if (!StringUtil.isNullOrEmpty(item.optString("material_lib_type"))) - goods.setMaterialLibType(item.optInt("material_lib_type")); - else + if (!StringUtil.isNullOrEmpty(item.optString("material_lib_type"))) { + try { + String materialLibType = item.optString("material_lib_type"); + goods.setMaterialLibType(Integer.parseInt(materialLibType.split(",")[0])); + } catch (Exception e) { + goods.setMaterialLibType(0); + } + + } else goods.setMaterialLibType(0); return goods; @@ -693,7 +699,7 @@ } String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); -// System.out.println("resultStr"+ resultStr); + // System.out.println("resultStr"+ resultStr); JSONObject data = JSONObject.fromObject(resultStr); if (data.optJSONObject("tbk_dg_material_optional_response") != null && data.optJSONObject("tbk_dg_material_optional_response").optJSONObject("result_list") != null) { @@ -1242,7 +1248,7 @@ dto.setPage(pageEntity); return dto; } - + /** * 搴楅摵鎼滅储 * @@ -1260,15 +1266,15 @@ map.put("method", "taobao.tbk.shop.get"); map.put("fields", "user_id,shop_title,shop_type,seller_nick,pict_url,shop_url"); map.put("q", filter.getKey()); - map.put("page_size", filter.getPageSize()+ ""); + map.put("page_size", filter.getPageSize() + ""); map.put("page_no", filter.getPage() + ""); - - if(!StringUtil.isNullOrEmpty(filter.getSort())) + + if (!StringUtil.isNullOrEmpty(filter.getSort())) map.put("sort", filter.getSort()); - - if(filter.getTmall() != null) + + if (filter.getTmall() != null) map.put("is_tmall", filter.getTmall() + ""); - + String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); JSONObject resultDate = JSONObject.fromObject(resultStr); if (resultDate.optJSONObject("tbk_shop_get_response") != null @@ -1290,7 +1296,6 @@ } return list; } - /** * 鍝佺墝鍒歌幏鍙� @@ -1497,9 +1502,13 @@ Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.item.click.extract"); map.put("click_url", link + ""); + + TaoKeAppInfo app = new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, + TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID); JSONObject resultJSON = null; try { - resultJSON = TaoKeBaseUtil.baseRequest(map, true); + resultJSON = TaoKeBaseUtil.baseRequest(map, app); + System.out.println(resultJSON); } catch (TaoKeApiException e) { e.printStackTrace(); } @@ -1955,7 +1964,7 @@ // 娣樼ぜ閲戝垱寤� public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum, Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime, TaoKeAppInfo app) - throws TaoLiJinCreateException,TaoKeApiException { + throws TaoLiJinCreateException, TaoKeApiException { Map<String, String> map = new HashMap<>(); map.put("method", "taobao.tbk.dg.vegas.tlj.create"); map.put("adzone_id", app.getPid().split("_")[3]); @@ -2076,6 +2085,24 @@ e.printStackTrace(); } } + + /** + * 鑾峰彇娣樺疂绯荤粺鏃堕棿 + * + * @return + */ + public static Date getTaoBaoSystemTime() { + Map<String, String> map = new HashMap<>(); + map.put("method", "taobao.time.get"); + try { + JSONObject json = TaoKeBaseUtil.baseRequest(map, false); + String time = json.optJSONObject("time_get_response").optString("time"); + return new Date(TimeUtil.convertToTimeTemp(time, "yyyy-MM-dd HH:mm:ss")); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } } class QuanInfo { -- Gitblit v1.8.0