From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 25 二月 2025 16:41:22 +0800 Subject: [PATCH] 淘宝转链接口更新 --- fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDGoodsServiceImpl.java | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDGoodsServiceImpl.java index aa55b59..ef92912 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDGoodsServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/pdd/PDDGoodsServiceImpl.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; +import com.yeshi.fanli.exception.pdd.PDDApiException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; @@ -128,7 +129,12 @@ if (cid == 1) { pddfilter.setPage(page); pddfilter.setPageSize(Constant.PAGE_SIZE); - PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter,Constant.PDD_SEARCH_CUSTOMER_PARAMS); + PDDGoodsResult result = null; + try { + result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS); + } catch (PDDApiException e) { + e.printStackTrace(); + } if (result == null) { return null; } else { @@ -141,7 +147,12 @@ pddfilter.setPage(page); pddfilter.setPageSize(Constant.PAGE_SIZE); pddfilter.setOptId(Long.parseLong(pddcid)); - PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter,Constant.PDD_SEARCH_CUSTOMER_PARAMS); + PDDGoodsResult result = null; + try { + result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS); + } catch (PDDApiException e) { + e.printStackTrace(); + } if (result == null) { return null; } else { @@ -159,7 +170,12 @@ pddfilter.setPage(page); pddfilter.setPageSize(10); pddfilter.setOptId(Long.parseLong(arrayId[i])); - PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter,Constant.PDD_SEARCH_CUSTOMER_PARAMS); + PDDGoodsResult result = null; + try { + result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS); + } catch (PDDApiException e) { + e.printStackTrace(); + } if (result != null) { List<PDDGoodsDetail> listGoods = result.getGoodsList(); if (listGoods != null && listGoods.size() > 0) { @@ -173,8 +189,9 @@ @Override @Cacheable(value = "pddSpecialCache", key = "'getTopGoodsList-' + #page + '-' + #sortType") public PDDGoodsResult getTopGoodsList(int page, Integer sortType) { - PDDGoodsResult pddResult = PinDuoDuoApiUtil.getTopList(PinDuoDuoApiUtil.PID_FANLI, page, Constant.PAGE_SIZE, - sortType); + //[4,7]锛�4-绉掓潃锛�7-鐧句嚎琛ヨ创锛�31-鍝佺墝榛戞爣锛�10564-绮鹃�夌垎鍝�-瀹樻柟鐩存帹鐖嗘锛�10584-绮鹃�夌垎鍝�-鍥㈤暱鎺ㄨ崘锛�24-鍝佺墝楂樹剑锛�20-琛屼笟绮鹃�夛紝21-閲戠墝鍟嗗锛�10044-娼滃姏鐖嗗搧锛�10475-鐖嗗搧涓婃柊 + PDDGoodsResult pddResult = PinDuoDuoApiUtil.searchByChannelType( page, Constant.PAGE_SIZE, + null,new Integer[]{4,7,10564}); if (pddResult != null && pddResult.getGoodsList() != null) Collections.shuffle(pddResult.getGoodsList()); return pddResult; -- Gitblit v1.8.0