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/goods/PDDCommonTemplateContentServiceImpl.java |  137 +++++++++++++++++++++------------------------
 1 files changed, 65 insertions(+), 72 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java
index bbd5575..258ebec 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/PDDCommonTemplateContentServiceImpl.java
@@ -1,72 +1,65 @@
-package com.yeshi.fanli.service.impl.goods;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Service;
-
-import com.yeshi.fanli.dto.common.CommonContentNav;
-import com.yeshi.fanli.dto.common.PDDCommonContentTypeEnum;
-import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
-import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
-import com.yeshi.fanli.service.inter.goods.PDDCommonTemplateContentService;
-import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
-import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
-
-@Service
-public class PDDCommonTemplateContentServiceImpl implements PDDCommonTemplateContentService {
-
-	@Cacheable(value = "pddCommonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
-	@Override
-	public PDDGoodsResult getContentList(PDDCommonContentTypeEnum type, String cid, int page, int pageSize) {
-		if (type == PDDCommonContentTypeEnum._1k9 || type == PDDCommonContentTypeEnum.todayTop 
-				|| type == PDDCommonContentTypeEnum.brandClear) {
-			return PinDuoDuoApiUtil.searchByChannelType(page - 1, pageSize, type.getContent());
-		} else if (type == PDDCommonContentTypeEnum.brandGoods) {
-			PDDSearchFilter pddfilter = new PDDSearchFilter();
-			pddfilter.setPage(page);
-			pddfilter.setPageSize(pageSize);
-			pddfilter.setSortType(22);
-			pddfilter.setHasCoupon(false);
-			if ("-1".equalsIgnoreCase(cid)) {
-				pddfilter.setOptId(-1L);
-			} else {
-				long catId = Long.parseLong(cid);
-				pddfilter.setCatId(catId);
-				pddfilter.setOptId(catId);
-			}
-			return PinDuoDuoUtil.getBrandGoods(pddfilter);
-		}
-		return null;
-	}
-	
-	
-	@Override
-	public List<CommonContentNav> getNavList(PDDCommonContentTypeEnum type) {
-		List<CommonContentNav> navList = new ArrayList<>();
-		if (type == PDDCommonContentTypeEnum.brandGoods) {
-			navList.add(new CommonContentNav("-1", "绮鹃��"));
-			//navList.add(new CommonContentNav("-11", "娓呬粨"));
-			navList.add(new CommonContentNav("15", "鐧捐揣 "));
-			navList.add(new CommonContentNav("4", "姣嶅┐"));
-			navList.add(new CommonContentNav("1", "椋熷搧"));
-			navList.add(new CommonContentNav("14", "濂宠"));
-			navList.add(new CommonContentNav("18", "鐢靛櫒"));
-			navList.add(new CommonContentNav("1281", "闉嬪寘"));
-			navList.add(new CommonContentNav("1282", "鍐呰。"));
-			navList.add(new CommonContentNav("16", "缇庡"));
-			navList.add(new CommonContentNav("743", "鐢疯"));
-			navList.add(new CommonContentNav("13", "姘存灉"));
-			navList.add(new CommonContentNav("818", "瀹剁汉"));
-			navList.add(new CommonContentNav("2478", "鏂囧叿"));
-			navList.add(new CommonContentNav("1451", "杩愬姩"));
-			navList.add(new CommonContentNav("590", "铏氭嫙"));
-			navList.add(new CommonContentNav("2048", "姹借溅"));
-			navList.add(new CommonContentNav("1917", "瀹惰"));
-			navList.add(new CommonContentNav("2974", "瀹跺叿"));
-			navList.add(new CommonContentNav("3279", "鍖昏嵂"));
-		}
-		return navList;
-	}
-}
+package com.yeshi.fanli.service.impl.goods;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import com.yeshi.fanli.dto.common.CommonContentNav;
+import com.yeshi.fanli.dto.common.PDDCommonContentTypeEnum;
+import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
+import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
+import com.yeshi.fanli.service.inter.goods.PDDCommonTemplateContentService;
+import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
+import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
+
+@Service
+public class PDDCommonTemplateContentServiceImpl implements PDDCommonTemplateContentService {
+
+	@Resource
+	private PDDGoodsService pddGoodsService;
+	 
+	
+	@Cacheable(value = "pddCommonContentCache", key = "#type+'-'+#cid+'-'+#page+'-'+#pageSize")
+	@Override
+	public PDDGoodsResult getContentList(PDDCommonContentTypeEnum type, String cid, int page, int pageSize) {
+		if (type == PDDCommonContentTypeEnum._1k9 || type == PDDCommonContentTypeEnum.todayTop 
+				|| type == PDDCommonContentTypeEnum.brandClear) {
+			return PinDuoDuoApiUtil.searchByChannelType(page - 1, pageSize, type.getContent(),null);
+		} else if (type == PDDCommonContentTypeEnum.hotSaleGoods) {
+			return pddGoodsService.getTopGoodsList(page, 2); // 鐑崠濂借揣
+		} else if (type == PDDCommonContentTypeEnum.todaySaleGoods) { // 鐑攢姒滃崟
+			int count = 0;
+			List<PDDGoodsDetail> list = new ArrayList<PDDGoodsDetail>(); 
+			PDDGoodsResult pddGoodsResult = pddGoodsService.getTodaySaleGoodsList();
+			if (pddGoodsResult != null) {
+				List<PDDGoodsDetail> goodsList = pddGoodsResult.getGoodsList();
+				if (goodsList != null) {
+					if (goodsList.size() >= (page * pageSize)) {
+						list.addAll(goodsList.subList((page-1)* pageSize, page * pageSize));
+					}
+					count = goodsList.size();
+				}
+			}
+			PDDGoodsResult pddResult = new PDDGoodsResult();
+			pddResult.setGoodsList(list);
+			pddResult.setTotalCount(count);
+			
+			return pddResult; 
+		}
+		return null;
+	}
+	
+	
+	@Override
+	public List<CommonContentNav> getNavList(PDDCommonContentTypeEnum type) {
+		List<CommonContentNav> navList = new ArrayList<>();
+		if (type == PDDCommonContentTypeEnum.hotSaleGoods) {
+			
+		}
+		return navList;
+	}
+}

--
Gitblit v1.8.0