yujian
2019-11-25 aa552facf6d833acab0d3e3e29bda2a0fb826ffe
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -32,6 +32,7 @@
import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.ShareGoodsTextTemplate;
import com.yeshi.fanli.entity.jd.JDGoods;
@@ -238,8 +239,12 @@
    */
   public void createTaoBaoShare(AcceptData acceptData, Long uid, Long goodsId, Integer totalNum, String source,
         HttpServletRequest request, PrintWriter out) {
      UserExtraTaoBaoInfo extraInfo = userExtraTaoBaoInfoService.getByUid(uid);
      UserInfoExtra userExtraInfo = userInfoExtraService.getUserInfoExtra(uid);
      String inviteCode = null;
      if (userExtraInfo != null)
         inviteCode = userExtraInfo.getInviteCode();
      String relationId = null;
      if (extraInfo != null && extraInfo.getRelationId() != null && extraInfo.getRelationValid() != null
            && extraInfo.getRelationValid() == true)
@@ -258,13 +263,8 @@
      try {
         ShareInfoVO shareInfo = new ShareInfoVO();
         // 测试
         List<String> commentTexts = new ArrayList<>();
         commentTexts.add("口令1");
         commentTexts.add("口令2口令口令淘口令口令口令淘口令");
         commentTexts.add("口令3");
         commentTexts.add("口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令口令口令淘口令");
         shareInfo.setCommentTexts(commentTexts);
         TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
@@ -281,6 +281,26 @@
         shareInfo.setToken(TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
         shareInfo.setRule(configService.get("share_single_goods_rule"));
         shareInfo.setPictUrl(TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
         String commentTextStr = configService.get("share_single_goods_comment_text");
         List<String> commentTexts = new ArrayList<>();
         if (!StringUtil.isNullOrEmpty(commentTextStr)) {
            JSONArray array = JSONArray.fromObject(commentTextStr);
            for (int i = 0; i < array.size(); i++) {
               if (StringUtil.isNullOrEmpty(inviteCode)) {
                  if (array.optString(i).contains("[邀请码]")) {
                     continue;
                  }
               }
               if (StringUtil.isNullOrEmpty(inviteCode))
                  commentTexts.add(array.optString(i).replace("[下载链接]", Constant.YINGYONGBAO_LINK)
                        .replace("[淘口令]", shareInfo.getToken()));
               else
                  commentTexts.add(array.optString(i).replace("[下载链接]", Constant.YINGYONGBAO_LINK)
                        .replace("[邀请码]", inviteCode).replace("[淘口令]", shareInfo.getToken()));
            }
         }
         shareInfo.setCommentTexts(commentTexts);
         String shareText = "";
         // 无券
@@ -592,7 +612,7 @@
      // goodsId + "");
      String couponUrl = null;
      JDCouponInfo couponInfo = jdGoods.getCouponInfo();
      JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(jdGoods);
      if (couponInfo != null) {
         couponUrl = couponInfo.getLink();
      }
@@ -601,8 +621,10 @@
      ShareInfoVO shareInfo = new ShareInfoVO();
      shareInfo.setClickUrl(jumpLink);
      shareInfo.setWxErCode(jumpLink);
      shareInfo.setRule(configService.get("share_rule_link_jd"));
      shareInfo.setPictUrl(jdGoods.getPicUrl());
      shareInfo.setCommentTexts(new ArrayList<>());
      String shareText = "";
      boolean hasCoupon = false;
@@ -711,6 +733,8 @@
      ShareInfoVO shareInfo = new ShareInfoVO();
      shareInfo.setClickUrl(jumpLink);
      shareInfo.setWxErCode(jumpLink);
      shareInfo.setCommentTexts(new ArrayList<>());
      shareInfo.setRule(configService.get("share_rule_link_pdd"));
      shareInfo.setPictUrl(goods.getGoodsImageUrl());
@@ -991,7 +1015,7 @@
      }
      String couponUrl = null;
      JDCouponInfo couponInfo = goods.getCouponInfo();
      JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods);
      if (couponInfo != null) {
         couponUrl = couponInfo.getLink();
      }