admin
2019-05-08 c5410b7f48a774e4ecd50019b46bc9173f2483ae
fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsController.java
@@ -22,6 +22,7 @@
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
@@ -56,6 +57,9 @@
   @Resource
   private UserInfoService userInfoService;
   @Resource
   private TaoBaoBuyRelationMapService taoBaoBuyRelationMapService;
   /**
    * 获取淘宝的分享链接
    * 
@@ -66,7 +70,7 @@
    * @param out
    */
   @RequestMapping(value = "gettaobaolink")
   public void getTaobaoShareLink(AcceptData acceptData, Long uid, Long auctionId, HttpServletRequest request,
   public void getTaoBaoLink(AcceptData acceptData, Long uid, Long auctionId,String from, HttpServletRequest request,
         PrintWriter out) {
      if (uid == null || uid <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
@@ -111,13 +115,13 @@
         specialConvert = false;
      String specialId = null;
      String relationId=null;
      String relationId = null;
      // 查询用户ID是否绑定了会员运营ID
      UserExtraTaoBaoInfo userInfo = userExtraTaoBaoInfoService.getByUid(uid);
      if (userInfo != null && !StringUtil.isNullOrEmpty(userInfo.getSpecialId()) && userInfo.getSpecialValid() != null
            && userInfo.getSpecialValid() == true) {
         specialId = userInfo.getSpecialId();
         relationId=userInfo.getRelationId();
         relationId = userInfo.getRelationId();
         // 已经绑定
         if (specialConvert) {
            isNative = true;
@@ -131,26 +135,48 @@
      }
      data.put("native", isNative);
      int pidType = PidUser.TYPE_FANLI_ANDROID;
      if (acceptData.getPlatform().equalsIgnoreCase("ios"))
         pidType = PidUser.TYPE_FANLI_IOS;
      try {
         int pidType = PidUser.TYPE_FANLI_ANDROID;
         if (acceptData.getPlatform().equalsIgnoreCase("ios"))
            pidType = PidUser.TYPE_FANLI_IOS;
         TaoBaoLink taoBaoLink = null;
         if (!StringUtil.isNullOrEmpty(specialId) && specialConvert) {
            taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
         } else {
            if (!specialConvert && !isNative) {
         // 是返利商品库的商品
         if (specialConvert) {
            if (!StringUtil.isNullOrEmpty(specialId)) {
               taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
               data.put("native", true);
            } else {
               if (!specialConvert && !isNative) {
                  if (pidType == PidUser.TYPE_FANLI_ANDROID)
                     taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
                           tbPidService.getAndroidDefault().getPid());
                  else
                     taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
                           tbPidService.getIOSDefault().getPid());
               } else
                  taoBaoLink = shareGoodsService.getTaoBaoLinkForBuy(uid, auctionId, pidType);
            }
         } else {// 不是返利库的商品,用特殊PID替代
            try {
               relationId = taoBaoBuyRelationMapService.getRelationId(uid);
            } catch (Exception e) {
               LogHelper.errorDetailInfo(e, "uid:" + uid, null);
            }
            if (!StringUtil.isNullOrEmpty(relationId)) {//
               taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId,
                     TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
               data.put("native", true);
            } else {
               if (pidType == PidUser.TYPE_FANLI_ANDROID)
                  taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
                        tbPidService.getAndroidDefault().getPid());
               else
                  taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
                        tbPidService.getIOSDefault().getPid());
            } else
               taoBaoLink = shareGoodsService.getTaoBaoLinkForBuy(uid, auctionId, pidType);
            }
         }
         JSONObject link = new JSONObject();
         link.put("clickUrl", taoBaoLink.getClickUrl());
         link.put("couponUrl", taoBaoLink.getCouponLink());