| | |
| | | * 微信小程序转链 @Title: convertWXMP @Description: @param goodsId @param |
| | | * pid @param customParams @return PDDPromotionUrl 返回类型 @throws |
| | | */ |
| | | public static String convertWXMP(Long goodsId, String pid, String customParams) { |
| | | public static String convertWXMP(String goodsId, String pid, String customParams) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.goods.promotion.url.generate"); |
| | | map.put("p_id", pid); |
| | |
| | | /** |
| | | * 获取商品详情 |
| | | * |
| | | * @param goodsId |
| | | * @param goodsSign |
| | | */ |
| | | public static PDDGoodsDetail getGoodsDetail(Long goodsId) { |
| | | public static PDDGoodsDetail getGoodsDetail(String goodsSign) { |
| | | try { |
| | | return getGoodsDetail(goodsId, PID_DEFAULT, "437031"); |
| | | return getGoodsDetail(goodsSign, PID_DEFAULT, "437031"); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static PDDGoodsDetail getGoodsDetail(Long goodsId, String pid, String customParameters) throws PDDApiException { |
| | | public static PDDGoodsDetail getGoodsDetail(String goodsSign, String pid, String customParameters) throws PDDApiException { |
| | | |
| | | PDDSearchFilter sf = new PDDSearchFilter(); |
| | | sf.setKw(goodsId + ""); |
| | | PDDGoodsResult goodsResult = searchGoods(sf, customParameters); |
| | | if (goodsResult == null) |
| | | return null; |
| | | |
| | | if (goodsResult.getGoodsList() == null || goodsResult.getGoodsList().size() <= 0) { |
| | | return null; |
| | | } |
| | | |
| | | String goodsSign = goodsResult.getGoodsList().get(0).getGoodsSign(); |
| | | // String goodsSign = goodsResult.getGoodsList().get(0).getGoodsSign(); |
| | | |
| | | |
| | | JSONArray array = new JSONArray(); |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | public static void main(String[] args) throws Exception{ |
| | | |
| | | // PDDConvertLinkResultVO vo = getAuthLink("8590899_72067894", 437031+""); |
| | | boolean isAuthed = isAuth(PID_DEFAULT, 437031+""); |
| | | System.out.println("是否授权:"+isAuthed); |
| | | // boolean isAuthed = isAuth(PID_DEFAULT, 437031+""); |
| | | // System.out.println("是否授权:"+isAuthed); |
| | | // |
| | | // System.out.println(vo); |
| | | PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(419563711836L); |
| | | PDDSearchFilter searchFilter=new PDDSearchFilter(); |
| | | searchFilter.setKw("鞋"); |
| | | searchFilter.setPage(1); |
| | | searchFilter.setPageSize(20); |
| | | PinDuoDuoApiUtil.searchGoods(searchFilter,Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | // PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(364476396740L); |
| | | |
| | | // PDDConvertLinkResultVO vo = convertChannel("0", PID_DEFAULT, null); |
| | | |
| | | // System.out.println(vo); |
| | | PDDConvertLinkResultVO goodsc = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "", "437031", false); |
| | | // PDDConvertLinkResultVO goodsc = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "", "437031", false); |
| | | |
| | | System.out.println(""); |
| | | // System.out.println(""); |
| | | } |
| | | } |