admin
2019-01-28 f7ed4e6bbe9be95d268481e66d70d90e70e07e12
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/ShareGoodsServiceImpl.java
@@ -490,6 +490,7 @@
      } catch (TaobaoGoodsDownException e) {
         throw new ShareGoodsException(4, "商品已下架");
      } finally {
      }
      if (goods == null) {
         throw new ShareGoodsException(5, "获取商品详情失败");
@@ -523,7 +524,34 @@
         throw new ShareGoodsException(2, "商品ID不能为空");
      }
      return getTaoBaoLink(uid, auctionId, Constant.TAOBAO_SPECIAL_PID_DEFAULT);
      TaoKeAppInfo app = new TaoKeAppInfo();
      app.setAppKey(Constant.TAOBAO_AUTH_APPKEY);
      app.setAppSecret(Constant.TAOBAO_AUTH_APPSECRET);
      app.setPid(Constant.TAOBAO_SPECIAL_PID_DEFAULT);
      TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
      if (goods == null) {
         throw new ShareGoodsException(1, "");
      }
      TaoBaoLink taoBaoLink = new TaoBaoLink();
      taoBaoLink.setAuctionId(auctionId);
      taoBaoLink.setClickUrl(goods.getAuctionUrl());
      taoBaoLink.setCouponLink(goods.getCouponLink());
      taoBaoLink.setGoods(goods);
      TaoBaoGoodsBrief taoBaoGoods = null;
      try {
         taoBaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
      } catch (TaobaoGoodsDownException e) {
         throw new ShareGoodsException(2, "商品为空");
      }
      String url = goods.getAuctionUrl();
      if (!StringUtil.isNullOrEmpty(goods.getCouponLink()))
         url = goods.getCouponLink();
      String token = TaoKeApiUtil.getTKToken(taoBaoGoods.getPictUrl(), taoBaoGoods.getTitle(), url);
      taoBaoLink.setTaoToken(token);
      return taoBaoLink;
   }
}