| | |
| | | } |
| | | |
| | | // 从转链搜索 |
| | | TaoBaoGoodsBrief newGoods = specialConvertCoupon(goods.getAuctionId(), |
| | | TaoBaoGoodsBrief newGoods = specialConvertCouponV2(goods.getAuctionId(), |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | TaoBaoConstant.TAOBAO_PID_DEFAULT), specialId, relationId); |
| | | |
| | |
| | | } |
| | | |
| | | // 从转链搜索 |
| | | TaoBaoGoodsBrief newGoods = specialConvertCoupon(goods.getAuctionId(), |
| | | TaoBaoGoodsBrief newGoods = specialConvertCouponV2(goods.getAuctionId(), |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | TaoBaoConstant.TAOBAO_PID_DEFAULT), null, null); |
| | | |
| | |
| | | JSONObject publishInfo = item.optJSONObject("publish_info"); |
| | | // 线报内容 |
| | | JSONObject mgcInfo = item.optJSONObject("mgc_info"); |
| | | |
| | | |
| | | |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | |
| | | } |
| | | |
| | | |
| | | public static TaoBaoGoodsBrief specialConvertCouponV2(String auctionId, TaoKeAppInfo app, String specialId, String relationId) { |
| | | String pid = app.getPid(); |
| | | String[] sts = pid.split("_"); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.general.link.convert"); |
| | | map.put("item_id_list", auctionId + ""); |
| | | map.put("adzone_id", sts[3]); |
| | | if (!StringUtil.isNullOrEmpty(specialId) && !StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(specialId)) { |
| | | map.put("special_id", specialId); |
| | | } else if (!StringUtil.isNullOrEmpty(relationId)) { |
| | | map.put("relation_id", relationId); |
| | | } |
| | | try { |
| | | String result = TaoKeBaseUtil.baseRequestForThreeTimes(map, app); |
| | | System.out.println(result); |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | JSONObject resultJSON = json.optJSONObject("tbk_dg_general_link_convert_response").optJSONObject("data") |
| | | .optJSONObject("item_url_list").optJSONArray("item_url_list").optJSONObject(0); |
| | | JSONObject goodsInfo=resultJSON.optJSONObject("link_info_dto"); |
| | | String couponLink = goodsInfo.optString("coupon_short_url"); |
| | | String itemLink = goodsInfo.optString("cps_short_url"); |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setAuctionUrl(itemLink); |
| | | goods.setCouponLink(couponLink); |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info"))) { |
| | | goods.setCouponLink(couponLink); |
| | | goods.setCouponInfo(resultJSON.optString("coupon_info")); |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_total_count"))) { |
| | | goods.setCouponTotalCount(Integer.parseInt(resultJSON.optString("coupon_total_count"))); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_remain_count"))) { |
| | | goods.setCouponLeftCount(Integer.parseInt(resultJSON.optString("coupon_remain_count"))); |
| | | } |
| | | |
| | | goods.setCouponEffectiveStartTime(resultJSON.optString("coupon_start_time")); |
| | | goods.setCouponEffectiveEndTime(resultJSON.optString("coupon_end_time")); |
| | | |
| | | } |
| | | |
| | | JSONObject rateInfo=resultJSON.optJSONObject("promotion_info_dto"); |
| | | String tkRate = rateInfo.optString("commission_rate"); |
| | | if (!StringUtil.isNullOrEmpty(tkRate)) { |
| | | goods.setTkRate(new BigDecimal(tkRate)); |
| | | } |
| | | goods = loadYuShouInfo(goods, resultJSON); |
| | | return goods; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | // AA5ISJ |
| | | |
| | | private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) { |
| | |
| | | // map.put("num_iids", "708395859317"); |
| | | // String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | // System.out.println(resultStr); |
| | | SearchFilter sf=new SearchFilter(); |
| | | sf.setKey("鞋"); |
| | | sf.setPage(1); |
| | | sf.setPageSize(20); |
| | | TaoBaoSearchResult result = searchWuLiaoNew(sf,null,null); |
| | | System.out.printf(result.toString()); |
| | | // SearchFilter sf=new SearchFilter(); |
| | | // sf.setKey("鞋"); |
| | | // sf.setPage(1); |
| | | // sf.setPageSize(20); |
| | | // TaoBaoSearchResult result = searchWuLiaoNew(sf,null,null); |
| | | // System.out.printf(result.toString()); |
| | | // public static final String TAOBAO_AUTH_APPKEY = "24980167"; |
| | | // public static final String TAOBAO_AUTH_APPSECRET = "e0a2e05deabf5ce039b52e5b492d5382"; |
| | | // public static final String TAOBAO_PID_DEFAULT="mm_124933865_56750082_89555600043"; |
| | | |
| | | |
| | | TaoKeAppInfo app = new TaoKeAppInfo("24980167", "e0a2e05deabf5ce039b52e5b492d5382", "mm_124933865_56750082_89555600043"); |
| | | |
| | | specialConvertCouponV2("ZMxBywvT6tPr0wabjaFBQPiVt6-g4DYZPC2OoJaaRXIoq", app, "511379263", null); |
| | | } |
| | | |
| | | } |