From afb7872d507a8558f734403d17936a62339cf318 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 29 七月 2019 18:01:56 +0800 Subject: [PATCH] 券链接处理 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 51 ++++++++++++++++++++++++++++----------------------- 1 files changed, 28 insertions(+), 23 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index 353236d..38a3175 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java @@ -75,6 +75,7 @@ import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.taobao.TaoLiJinUtil; +import com.yeshi.fanli.vo.goods.CouponInfoVO; import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO; import com.yeshi.fanli.vo.goods.GoodsDetailVO; import com.yeshi.fanli.vo.goods.MoneyInfoVO; @@ -396,9 +397,8 @@ extraVO.setIsNative(true); } - // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), id + ""); + String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -519,9 +519,7 @@ } // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl()); ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -585,8 +583,16 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, null, fanLiRate, shareRate); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, fanLiRate, shareRate); + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + if (couponInfo != null) { + // 鍒搁摼鎺ュ鐞� + String materialId = "https://item.jd.com/" + id + ".html"; + String url = JDApiUtil.convertShortLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON+"", null); + couponInfo.setLink(url); + } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); if (shopInfo != null) { if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null @@ -649,8 +655,8 @@ } // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), jdGoods.getSkuId() + "", Constant.SOURCE_TYPE_JD); + String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -664,11 +670,7 @@ helpLink = configService.get("no_rebate_help_link"); } - // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + jdGoods.getSkuId(), - Constant.systemCommonConfig.getAppShareInfoUrl()); ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -717,8 +719,13 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, null, fanLiRate, shareRate); - + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate); + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + if (couponInfo != null) { + String url = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null); + couponInfo.setLink(url); + } + ShopInfoVO shopInfo = goodsDetail.getShopInfo(); if (shopInfo != null) { if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null @@ -782,9 +789,9 @@ extraVO.setIsNative(true); } - // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), id + "", Constant.SOURCE_TYPE_PDD); + // 鍒嗕韩璺緞 + String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -798,10 +805,8 @@ if (StringUtil.isNullOrEmpty(helpLink)) { helpLink = configService.get("no_rebate_help_link"); } - // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl()); + ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -853,7 +858,7 @@ List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); for (JDGoods goods: list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, null, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate)); } // 鍙栧伓鏁颁釜鏁版嵁 @@ -893,7 +898,7 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, null, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate)); } } } @@ -1024,7 +1029,7 @@ if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", id + ""); + String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); JSONObject data = new JSONObject(); data.put("native", true); -- Gitblit v1.8.0