From 34e65d72e73acab040b68d01ef6b4764b4408624 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 05 八月 2019 10:07:38 +0800 Subject: [PATCH] 修改推荐记录点击详情跳转方式不对的bug --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java | 74 ++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 34 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java index bb251d5..34c2584 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java @@ -71,6 +71,7 @@ import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil; import com.yeshi.fanli.util.factory.MonitorFactory; import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; +import com.yeshi.fanli.util.jd.JDApiUtil; import com.yeshi.fanli.util.jd.JDUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; @@ -538,25 +539,28 @@ return; } - String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePathJD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), - goodsId + ""); +// String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), +// Constant.systemCommonConfig.getShareGoodsPagePathJD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), +// goodsId + ""); - // 鍒哥煭杩炴帴 - String shortLink = HttpUtil.getShortLink(url); - if (!StringUtil.isNullOrEmpty(shortLink)) { - url = shortLink; + String couponUrl = null; + JDCouponInfo couponInfo = jdGoods.getCouponInfo(); + if (couponInfo != null) { + couponUrl = couponInfo.getLink(); } + String materialId = "https://item.jd.com/" + goodsId + ".html"; + String jumpLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid+ ""); + ShareInfoVO shareInfo = new ShareInfoVO(); - shareInfo.setClickUrl(url); + shareInfo.setClickUrl(jumpLink); shareInfo.setRule(configService.get("share_rule_link_jd")); shareInfo.setPictUrl(jdGoods.getPicUrl()); - + String shareText = ""; boolean hasCoupon = false; + // 鍒嗕韩妯℃澘 - JDCouponInfo couponInfo = jdGoods.getCouponInfo(); ShareGoodsTextTemplate textTemplate = shareGoodsTextTemplateService.getShareGoodsTextTemplate(uid); if (couponInfo == null) { // 鏃犲埜妯℃澘 if (textTemplate != null) @@ -572,7 +576,7 @@ if (StringUtil.isNullOrEmpty(shareText)) shareText = configService.get("goods_share_text_coupon_jd"); } - shareText = shareGoodsTextTemplateService.createContentByTemplateJD(shareText, uid, jdGoods, shortLink, hasCoupon); + shareText = shareGoodsTextTemplateService.createContentByTemplateJD(shareText, uid, jdGoods, jumpLink, hasCoupon); shareInfo.setShareText(shareText); String descText = shareText.replace(jdGoods.getSkuName(), "").trim(); @@ -649,17 +653,14 @@ return; } - String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePathPDD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), - goodsId + ""); +// String url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), +// Constant.systemCommonConfig.getShareGoodsPagePathPDD(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), +// goodsId + ""); - String shortLink = HttpUtil.getShortLink(url); - if (!StringUtil.isNullOrEmpty(shortLink)) { - url = shortLink; - } + String jumpLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + ""); ShareInfoVO shareInfo = new ShareInfoVO(); - shareInfo.setClickUrl(url); + shareInfo.setClickUrl(jumpLink); shareInfo.setRule(configService.get("share_rule_link_pdd")); shareInfo.setPictUrl(goods.getGoodsImageUrl()); @@ -685,7 +686,7 @@ String token = PinDuoDuoApiUtil.createGenerate(goodsId); // 鐢熸垚鍒嗕韩鍐呭 - String shareText = shareGoodsTextTemplateService.createContentByTemplatePDD(template, uid, goods, shortLink, + String shareText = shareGoodsTextTemplateService.createContentByTemplatePDD(template, uid, goods, jumpLink, hasCoupon, token); shareInfo.setShareText(shareText); @@ -711,7 +712,7 @@ try { ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, goodsId, - Constant.SOURCE_TYPE_JD); + Constant.SOURCE_TYPE_PDD); shareInfo.setShareId(shareRecord.getRedisKey()); } catch (Exception e) { try { @@ -731,7 +732,7 @@ history.setUser(new UserInfo(uid)); history.setHongbao(shareMoney); history.setCreateTime(new Date()); - history.setGoodsType(Constant.SOURCE_TYPE_JD); + history.setGoodsType(Constant.SOURCE_TYPE_PDD); history.setTkCode(null); history.setLink(null); history.setQuanLink(null); @@ -785,12 +786,12 @@ return; } - if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { + if (goodsType == Constant.SOURCE_TYPE_JD) { createJDViewText(goodsType, uid, template, goodsId, hasCoupon, out); return; } - if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { + if (goodsType == Constant.SOURCE_TYPE_PDD) { createPDDViewText(goodsType, uid, template, goodsId, hasCoupon, out); return; } @@ -939,10 +940,13 @@ } } - String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), - goodsId + ""); - String shortLink = HttpUtil.getShortLink(url); + String couponUrl = null; + JDCouponInfo couponInfo = goods.getCouponInfo(); + if (couponInfo != null) { + couponUrl = couponInfo.getLink(); + } + String materialId = "https://item.jd.com/" + goodsId + ".html"; + String shortLink = JDApiUtil.convertShortLink(materialId, couponUrl, JDApiUtil.POSITION_SHARE + "", uid+ ""); String content = shareGoodsTextTemplateService.createContentByTemplateJD(template, uid, goods, shortLink, hasCoupon); @@ -952,7 +956,7 @@ } /** - * 鍒涘缓浜笢鍒嗕韩妯℃澘 + * 鍒涘缓鎷煎澶氬垎浜ā鏉� * * @param uid * @param template @@ -994,11 +998,13 @@ } } - // 鍒涘缓h5杩炴帴 - String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), - goodsId + ""); - String shortLink = HttpUtil.getShortLink(url); +// // 鍒涘缓h5杩炴帴 +// String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), +// Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY), +// goodsId + ""); +// String shortLink = HttpUtil.getShortLink(url); + + String shortLink = PinDuoDuoApiUtil.getPromotionUrl(goodsId, PinDuoDuoApiUtil.PID_SHARE + "", uid + ""); // 鍒涘缓鍙d护 String token = PinDuoDuoApiUtil.createGenerate(goodsId); -- Gitblit v1.8.0