| | |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | public TaoBaoLink getTaoBaoLinkForRecieveCoupon(SystemEnum system, Long auctionId, String specialId, String pid) throws TaoBaoConvertLinkException { |
| | | if (auctionId == null || auctionId <= 0) { |
| | | public TaoBaoLink getTaoBaoLinkForRecieveCoupon(SystemEnum system, String auctionId, String specialId, String pid) throws TaoBaoConvertLinkException { |
| | | if (StringUtil.isNullOrEmpty(auctionId)) { |
| | | throw new TaoBaoConvertLinkException(2, "商品ID不能为空"); |
| | | } |
| | | |
| | |
| | | |
| | | String link = null; |
| | | try { |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, app.getPid()); |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, app.getPid(),false); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | |
| | | return taoBaoLink; |
| | | } |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app, specialId, null); |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, app, specialId, null); |
| | | if (goods == null) { |
| | | throw new TaoBaoConvertLinkException(1, ""); |
| | | } |
| | |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | public TaoBaoLink getTaoBaoLinkForBuy(SystemEnum system, Long uid, Long auctionId, String specialId, String pid) throws TaoBaoConvertLinkException { |
| | | public TaoBaoLink getTaoBaoLinkForBuy(SystemEnum system, Long uid, String auctionId, String specialId, String pid) throws TaoBaoConvertLinkException { |
| | | if (uid == null || uid <= 0) { |
| | | throw new TaoBaoConvertLinkException(1, "用户ID不能为空"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private void cacheCouponInfo(Long auctionId, String link, String pid) { |
| | | private void cacheCouponInfo(String auctionId, String link, String pid) { |
| | | String activityId = TaoBaoUtil.getActivityIdFromCouponLink(link); |
| | | if (StringUtil.isNullOrEmpty(activityId)) |
| | | return; |
| | |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | public TaoBaoLink getTaoBaoLinkForShare(SystemEnum system, Long uid, Long auctionId, String relationId, String pid) throws |
| | | public TaoBaoLink getTaoBaoLinkForShare(SystemEnum system, Long uid, String auctionId, String relationId, String pid) throws |
| | | TaoBaoConvertLinkException { |
| | | if (uid == null || uid <= 0) { |
| | | throw new TaoBaoConvertLinkException(1, "用户ID不能为空"); |
| | | } |
| | | |
| | | if (auctionId == null || auctionId <= 0) { |
| | | if (StringUtil.isNullOrEmpty(auctionId)) { |
| | | throw new TaoBaoConvertLinkException(2, "商品ID不能为空"); |
| | | } |
| | | |
| | |
| | | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |
| | |
| | | DaTaoKeFilterResult result = daTaoKeGoodsDetailV2Service.filterTaoBaoGoods(goods); |
| | | if (result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_COUPON |
| | | || result.getFilterType() == DaTaoKeFilterResult.FILTER_TYPE_PRICE_AND_COUPON) { |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid()); |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid(),true); |
| | | } else if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {// 有券 |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid()); |
| | | |
| | | link = DaTaoKeApiUtil.convertLink(auctionId, info.getPid(),true); |
| | | } |
| | | |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | |
| | | //保存券链接 |
| | | cacheCouponInfo(goods, info.getPid()); |
| | | } else { |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |
| | |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, Long auctionId, String pid) throws TaoBaoConvertLinkException { |
| | | public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, String auctionId, String pid) throws TaoBaoConvertLinkException { |
| | | if (uid == null || uid <= 0) |
| | | throw new TaoBaoConvertLinkException(1, "用户ID不能为空"); |
| | | |
| | | if (auctionId == null || auctionId <= 0) |
| | | if (StringUtil.isNullOrEmpty(auctionId)) |
| | | throw new TaoBaoConvertLinkException(1, "商品ID不能为空"); |
| | | |
| | | TaoBaoGoodsBrief goods = null; |
| | |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | public TaoBaoLink getTaoLiJinLinkForShare(SystemEnum system, Long uid, Long auctionId, String relationId, String pid) throws |
| | | public TaoBaoLink getTaoLiJinLinkForShare(SystemEnum system, Long uid, String auctionId, String relationId, String pid) throws |
| | | TaoBaoConvertLinkException { |
| | | if (uid == null || uid <= 0) { |
| | | throw new TaoBaoConvertLinkException(1, "用户ID不能为空"); |
| | | } |
| | | |
| | | if (auctionId == null || auctionId <= 0) { |
| | | if (StringUtil.isNullOrEmpty(auctionId)) { |
| | | throw new TaoBaoConvertLinkException(2, "商品ID不能为空"); |
| | | } |
| | | |
| | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponLink()) && !goods.getAuctionUrl().contains("s.click.taobao.com")) { |
| | | TaoBaoUnionConfig taoBaoUnionConfig = taoBaoUnionConfigService |
| | | .getConfigByAppIdCache(info.getPid().split("_")[2]); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCoupon(auctionId, info, null, relationId); |
| | | TaoBaoGoodsBrief taoBaoLink = TaoKeApiUtil.specialConvertCouponV2(auctionId, info, null, relationId); |
| | | if (taoBaoLink == null) { |
| | | throw new TaoBaoConvertLinkException(201, "商品转链失败"); |
| | | } |