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/util/cache/HttpGoodsCacheManager.java | 349 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 175 insertions(+), 174 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/cache/HttpGoodsCacheManager.java b/fanli/src/main/java/com/yeshi/fanli/util/cache/HttpGoodsCacheManager.java index 7182d6e..5707c4a 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/cache/HttpGoodsCacheManager.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/cache/HttpGoodsCacheManager.java @@ -1,174 +1,175 @@ -package com.yeshi.fanli.util.cache; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.annotation.Resource; - -import org.springframework.stereotype.Component; -import org.yeshi.utils.HttpUtil; - -import com.yeshi.fanli.dto.common.CommonContentNav; -import com.yeshi.fanli.dto.common.CommonContentTypeEnum; -import com.yeshi.fanli.entity.brand.BrandClass; -import com.yeshi.fanli.entity.bus.clazz.GoodsClass; -import com.yeshi.fanli.service.inter.brand.BrandClassService; -import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService; -import com.yeshi.fanli.service.inter.goods.GoodsClassService; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.taobao.DaTaoKeUtil; - -/** - * 閲囩敤http璇锋眰瑙﹀彂鍟嗗搧缂撳瓨 - * - * @author Administrator - * - */ -@Component -public class HttpGoodsCacheManager { - - @Resource - private CommonTemplateContentService commonTemplateContentService; - - @Resource - private GoodsClassService goodsClassService; - - @Resource - private BrandClassService brandClassService; - - private static String getSign(Map<String, String> params) { - List<String> list = new ArrayList<>(); - Iterator<String> its = params.keySet().iterator(); - while (its.hasNext()) { - String key = its.next(); - Object value = params.get(key); - list.add(key + "=" + value.toString()); - } - Collections.sort(list); - String str = ""; - for (String st : list) { - str += st + "&"; - } - String sign = null; - - sign = StringUtil.Md5(str + Constant.systemCommonConfig.getSignKey()); - return sign; - } - - private void request(String url, Map<String, String> par) { - Map<String, String> params = new HashMap<>(); - params.put("packages", "com.yeshi.ec.rebate"); - params.put("Version", "46"); - params.put("appkey", "24587154"); - params.put("platform", "android"); - params.put("apiversion", "1"); - params.put("channel", "GuanWang"); - params.put("imei", "862977040115210"); - params.put("osVersion", "8.0.0"); - params.put("network", "WIFI"); - params.put("deviceType", "LND-AL30"); - params.put("time", System.currentTimeMillis() + ""); - params.put("Device", "da105e2c-a7e8-3739-8fb8-4100da3c3aac"); - - if (par != null) { - for (Iterator<String> its = par.keySet().iterator(); its.hasNext();) { - String key = its.next(); - params.put(key, par.get(key)); - } - } - params.put("time", System.currentTimeMillis() + ""); - params.put("sign", getSign(params)); - String result = HttpUtil.post(url, params, null); - System.out.println(result); - } - - // 瑙﹀彂棣栭〉鐨勫晢鍝佹洿鏂� - public void requestHomeRecommend() { - Map<String, String> params = new HashMap<>(); - params.put("goodsType", 1 + ""); - for (int p = 1; p < 5; p++) { - params.put("page", p + ""); - request("http://api.flqapp.com/fanli/api/v2/recommend/getGoodList", params); - } - } - - // 瑙﹀彂閫氱敤妯℃澘 - public void requestCommonTemplate() { - CommonContentTypeEnum[] types = CommonContentTypeEnum.values(); - for (int p = 1; p < 3; p++) { - for (CommonContentTypeEnum type : types) { - List<CommonContentNav> navList = commonTemplateContentService.getNavList(type); - if (navList != null && navList.size() > 0) - for (CommonContentNav nav : navList) { - commonTemplateContentService.getContentList(type, nav.getCid(), p, 50); - } - else { - commonTemplateContentService.getContentList(type, null, p, 50); - } - } - } - } - - // 瑙﹀彂鍒嗙被鍟嗗搧 - public void requestClassGoods() { - Map<String, String> params = new HashMap<>(); - List<GoodsClass> classList = goodsClassService.getEffectiveClassCache(); - for (int p = 1; p < 3; p++) { - params.put("page", p + ""); - for (GoodsClass gc : classList) - params.put("gcid", gc.getId() + ""); - request("http://api.flqapp.com/fanli/api/v2/class/getClassGoods", params); - } - } - - // 瑙﹀彂鍔ㄦ�� - public void requestDynamic() { - // 鐑攢 - List<GoodsClass> list = new ArrayList<GoodsClass>(); - list.add(new GoodsClass(0L, "浠婃棩鍗曞搧")); - list.addAll(DaTaoKeUtil.goodsClasses); - - for (int p = 1; p < 5; p++) { - Map<String, String> params = new HashMap<>(); - params.put("cid", 1 + ""); - params.put("page", p + ""); - for (GoodsClass gc : list) { - params.put("subId", gc.getId() + ""); - request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); - } - // 鎺ㄨ崘 - params = new HashMap<>(); - params.put("cid", 2 + ""); - params.put("page", p + ""); - request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); - - // 濂藉簵 - params = new HashMap<>(); - params.put("cid", 3 + ""); - params.put("page", p + ""); - request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); - } - } - - // 瑙﹀彂鍝佺墝鍟嗗搧鍒楄〃 - public void requestBrandGoods() { - List<BrandClass> list = brandClassService.listBrandClassEffectiveCache(); - list.add(new BrandClass(0L)); - list.addAll(list); - for (int p = 1; p < 5; p++) { - Map<String, String> params = new HashMap<>(); - params.put("page", p + ""); - for (BrandClass gc : list) { - params.put("cid", gc.getId() + ""); - request("http://api.flqapp.com/fanli/api/v2/brand/getShopList", params); - } - } - - } - -} +package com.yeshi.fanli.util.cache; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.SystemEnum; +import org.springframework.stereotype.Component; +import org.yeshi.utils.HttpUtil; + +import com.yeshi.fanli.dto.common.CommonContentNav; +import com.yeshi.fanli.dto.common.CommonContentTypeEnum; +import com.yeshi.fanli.entity.brand.BrandClass; +import com.yeshi.fanli.entity.bus.clazz.GoodsClass; +import com.yeshi.fanli.service.inter.brand.BrandClassService; +import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService; +import com.yeshi.fanli.service.inter.goods.GoodsClassService; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; +import com.yeshi.fanli.util.taobao.DaTaoKeUtil; + +/** + * 閲囩敤http璇锋眰瑙﹀彂鍟嗗搧缂撳瓨 + * + * @author Administrator + * + */ +@Component +public class HttpGoodsCacheManager { + + @Resource + private CommonTemplateContentService commonTemplateContentService; + + @Resource + private GoodsClassService goodsClassService; + + @Resource + private BrandClassService brandClassService; + + private static String getSign(Map<String, String> params) { + List<String> list = new ArrayList<>(); + Iterator<String> its = params.keySet().iterator(); + while (its.hasNext()) { + String key = its.next(); + Object value = params.get(key); + list.add(key + "=" + value.toString()); + } + Collections.sort(list); + String str = ""; + for (String st : list) { + str += st + "&"; + } + String sign = null; + + sign = StringUtil.Md5(str + Constant.systemCommonConfig.getSignKey()); + return sign; + } + + private void request(String url, Map<String, String> par) { + Map<String, String> params = new HashMap<>(); + params.put("packages", "com.yeshi.ec.rebate"); + params.put("Version", "46"); + params.put("appkey", "24587154"); + params.put("platform", "android"); + params.put("apiversion", "1"); + params.put("channel", "GuanWang"); + params.put("imei", "862977040115210"); + params.put("osVersion", "8.0.0"); + params.put("network", "WIFI"); + params.put("deviceType", "LND-AL30"); + params.put("time", System.currentTimeMillis() + ""); + params.put("Device", "da105e2c-a7e8-3739-8fb8-4100da3c3aac"); + + if (par != null) { + for (Iterator<String> its = par.keySet().iterator(); its.hasNext();) { + String key = its.next(); + params.put(key, par.get(key)); + } + } + params.put("time", System.currentTimeMillis() + ""); + params.put("sign", getSign(params)); + String result = HttpUtil.post(url, params, null); + System.out.println(result); + } + + // 瑙﹀彂棣栭〉鐨勫晢鍝佹洿鏂� + public void requestHomeRecommend() { + Map<String, String> params = new HashMap<>(); + params.put("goodsType", 1 + ""); + for (int p = 1; p < 5; p++) { + params.put("page", p + ""); + request("http://api.flqapp.com/fanli/api/v2/recommend/getGoodList", params); + } + } + + // 瑙﹀彂閫氱敤妯℃澘 + public void requestCommonTemplate() { + CommonContentTypeEnum[] types = CommonContentTypeEnum.values(); + for (int p = 1; p < 3; p++) { + for (CommonContentTypeEnum type : types) { + List<CommonContentNav> navList = commonTemplateContentService.getNavList(type,SystemEnum.blks); + if (navList != null && navList.size() > 0) + for (CommonContentNav nav : navList) { + commonTemplateContentService.getContentList(type, nav.getCid(), p, 50, SystemEnum.blks); + } + else { + commonTemplateContentService.getContentList(type, null, p, 50, SystemEnum.blks); + } + } + } + } + + // 瑙﹀彂鍒嗙被鍟嗗搧 + public void requestClassGoods() { + Map<String, String> params = new HashMap<>(); + List<GoodsClass> classList = goodsClassService.getEffectiveClassCache(); + for (int p = 1; p < 3; p++) { + params.put("page", p + ""); + for (GoodsClass gc : classList) + params.put("gcid", gc.getId() + ""); + request("http://api.flqapp.com/fanli/api/v2/class/getClassGoods", params); + } + } + + // 瑙﹀彂鍔ㄦ�� + public void requestDynamic() { + // 鐑攢 + List<GoodsClass> list = new ArrayList<GoodsClass>(); + list.add(new GoodsClass(0L, "浠婃棩鍗曞搧")); + list.addAll(DaTaoKeUtil.goodsClasses); + + for (int p = 1; p < 5; p++) { + Map<String, String> params = new HashMap<>(); + params.put("cid", 1 + ""); + params.put("page", p + ""); + for (GoodsClass gc : list) { + params.put("subId", gc.getId() + ""); + request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); + } + // 鎺ㄨ崘 + params = new HashMap<>(); + params.put("cid", 2 + ""); + params.put("page", p + ""); + request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); + + // 濂藉簵 + params = new HashMap<>(); + params.put("cid", 3 + ""); + params.put("page", p + ""); + request("http://api.flqapp.com/fanli/api/v2/dynamic/getList", params); + } + } + + // 瑙﹀彂鍝佺墝鍟嗗搧鍒楄〃 + public void requestBrandGoods() { + List<BrandClass> list = brandClassService.listBrandClassEffectiveCache(null); + list.add(new BrandClass(0L)); + list.addAll(list); + for (int p = 1; p < 5; p++) { + Map<String, String> params = new HashMap<>(); + params.put("page", p + ""); + for (BrandClass gc : list) { + params.put("cid", gc.getId() + ""); + request("http://api.flqapp.com/fanli/api/v2/brand/getShopList", params); + } + } + + } + +} -- Gitblit v1.8.0