admin
2021-01-27 e1a62ec62e7331d97af9302e90e1ce44af8235eb
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(),null,
            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, null,JDApiUtil.POSITION_COUPON + "",
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_COUPON + "",
                    "");
            if (jumpLink == null) {
                jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null,JDApiUtil.POSITION_COUPON + "",
                jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_COUPON + "",
                        "");
            }
        } else {
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null,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, null,JDApiUtil.POSITION_FANLI + "",
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "",
                    uid + "");
            if (jumpLink == null) {
                jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null,JDApiUtil.POSITION_FANLI + "",
                jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, null, null, JDApiUtil.POSITION_FANLI + "",
                        uid + "");
            }
        } else {
            jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null,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, null,JDApiUtil.POSITION_FANLI + "", null);
        jumpLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, null, JDApiUtil.POSITION_FANLI + "", null);
        if (StringUtil.isNullOrEmpty(jumpLink)) {
            jumpLink = couponUrl;
        }
@@ -1782,13 +1811,14 @@
        }
        //TODO 是否需要返回绑定链接
        boolean auth = PinDuoDuoApiUtil.isAuth(pid, uid + "");
        PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, pid + "", uid + "", !auth);
        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));
        // 获得金币
@@ -2073,7 +2103,7 @@
            return;
        }
        link = JDApiUtil.convertLinkWithSubUnionId(link, null, null,JDApiUtil.POSITION_FANLI + "", uid + "");
        link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + "");
        JSONObject data = new JSONObject();
        data.put("link", link);