From e1a62ec62e7331d97af9302e90e1ce44af8235eb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 27 一月 2021 15:26:55 +0800 Subject: [PATCH] 拼多多授权绑定 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 59 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 45 insertions(+), 14 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 7d75fde..fa5ef77 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 @@ -11,6 +11,7 @@ import com.yeshi.fanli.entity.SystemEnum; import com.yeshi.fanli.entity.SystemFunction; +import com.yeshi.fanli.service.inter.pdd.PDDAuthService; import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; import com.yeshi.fanli.util.*; import org.json.simple.JSONArray; @@ -209,6 +210,10 @@ @Resource private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService; + + + @Resource + private PDDAuthService pddAuthService; private ConfigParamsDTO getParamsDTO(String platform, String version, Long uid, SystemEnum system) { UserLevelEnum level = UserLevelEnum.daRen; @@ -790,7 +795,7 @@ if (couponInfo != null) { // 鍒搁摼鎺ュ鐞� String materialId = "https://item.jd.com/" + id + ".html"; - String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), + String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(), null, JDApiUtil.POSITION_COUPON + "", null); couponInfo.setLink(url); } @@ -923,7 +928,7 @@ return; } - PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id,PinDuoDuoApiUtil.PID_FANLI,uid+""); + PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); if (pddGoods == null) { out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); return; @@ -1066,6 +1071,14 @@ if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { getCloudInfo(acceptData, uid, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭� + } + + if (extraVO.getListCouponUser() == null) { + extraVO.setListCouponUser(new ArrayList<>()); + } + + if (extraVO.getListShareUser() == null) { + extraVO.setListShareUser(new ArrayList<>()); } // 鍏嶅崟鍟嗗搧 @@ -1214,6 +1227,14 @@ shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); + if (extraVO.getListShareUser() == null) { + extraVO.setListShareUser(new ArrayList<>()); + } + + if (extraVO.getListCouponUser() == null) { + extraVO.setListCouponUser(new ArrayList<>()); + } + // 浜戝彂鍗曟枃妗堜俊鎭� getCloudInfo(acceptData, uid, goodsDetail, extraVO); @@ -1347,6 +1368,14 @@ ShareVO shareInfoVO = new ShareVO(); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); + + if (extraVO.getListShareUser() == null) { + extraVO.setListShareUser(new ArrayList<>()); + } + + if (extraVO.getListCouponUser() == null) { + extraVO.setListCouponUser(new ArrayList<>()); + } // 浜戝彂鍗曟枃妗堜俊鎭� getCloudInfo(acceptData, uid, goodsDetail, extraVO); @@ -1489,7 +1518,7 @@ Long[] strings = new Long[goodsIdList.size()]; pddfilter.setGoodsIdList(goodsIdList.toArray(strings)); - PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter,Constant.PDD_SEARCH_CUSTOMER_PARAMS); + PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter, Constant.PDD_SEARCH_CUSTOMER_PARAMS); if (result != null) { List<PDDGoodsDetail> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { @@ -1621,14 +1650,14 @@ if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_COUPON + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", ""); if (jumpLink == null) { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_COUPON + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_COUPON + "", ""); } } else { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_COUPON + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "", ""); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; @@ -1690,14 +1719,14 @@ if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", uid + ""); if (jumpLink == null) { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); } } else { - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", uid + ""); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; @@ -1727,7 +1756,7 @@ String jumpLink = null; String materialId = "https://item.jd.com/" + id + ".html"; - jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", null); + jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", null); if (StringUtil.isNullOrEmpty(jumpLink)) { jumpLink = couponUrl; } @@ -1781,13 +1810,15 @@ return; } - boolean auth = PinDuoDuoApiUtil.isAuth(pid, uid + ""); - PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, pid + "", uid + "", !auth); + //TODO 鏄惁闇�瑕佽繑鍥炵粦瀹氶摼鎺� + String customParams = pddAuthService.getFanliCustomParams(uid); + boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); + PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, pid + "", customParams, !auth); JSONObject data = new JSONObject(); data.put("native", true); data.put("jumpLink", convertUrl.getUrl()); data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); - LogHelper.test(String.format("鎷煎澶氳浆閾�:uid:%s data:%s",uid+"",data.toString())); + LogHelper.test(String.format("鎷煎澶氳浆閾�:uid:%s data:%s", uid + "", data.toString())); out.print(JsonUtil.loadTrueResult(data)); // 鑾峰緱閲戝竵 @@ -2072,7 +2103,7 @@ return; } - link = JDApiUtil.convertLinkWithSubUnionId(link, null, JDApiUtil.POSITION_FANLI + "", uid + ""); + link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); JSONObject data = new JSONObject(); data.put("link", link); -- Gitblit v1.8.0