From dc5be7d38446f70e6ff86df311119c32b41fe7f8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 28 十一月 2020 16:37:05 +0800 Subject: [PATCH] 大淘客搜索接口升级 --- fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java index 250ff80..aa8ce63 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/vipshop/VipShopUtil.java @@ -3,9 +3,10 @@ import java.math.BigDecimal; import org.yeshi.utils.BigDecimalUtil; +import org.yeshi.utils.NumberUtil; import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; -import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import org.yeshi.utils.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; public class VipShopUtil { @@ -47,6 +48,11 @@ } + public static String getCouponChanTag() { + return getBase64Str("coupon"); + + } + public static String getUidFromChanTag(String tag) { String decodeTag = StringUtil.getFromBase64(tag); return decodeTag.split("#")[1]; @@ -54,7 +60,7 @@ public static String getTypeFromChanTag(String tag) { String decodeTag = StringUtil.getFromBase64(tag); - return decodeTag.split("#")[1]; + return decodeTag.split("#")[0]; } public static BigDecimal getGoodsFanLiMoney(VIPGoodsInfo goods, BigDecimal rate) { @@ -80,4 +86,18 @@ return StringUtil.Md5(orderSn + "#" + goodsId + "#" + sizeId); } + + public static String parseGoodsIdByUrl(String url) { + try { + if (url.contains(".vip.com/") && (url.contains("detail-") || url.contains("product-"))) { + String preUrl = url.split("\\?")[0]; + String goodsId = preUrl.split("-")[preUrl.split("-").length - 1].replace(".html", "").replace(".htm", + ""); + if (NumberUtil.isNumeric(goodsId)) + return goodsId; + } + } catch (Exception e) { + } + return null; + } } -- Gitblit v1.8.0