| | |
| | | for (String shortLink : linkSet) { |
| | | String goodsId = PinDuoDuoUtil.getPDDGoodsId(shortLink); |
| | | if (!StringUtil.isNullOrEmpty(goodsId)) { |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId)); |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(goodsId); |
| | | if (goodsDetail == null) |
| | | throw new Exception("拼多多转链失败"); |
| | | PDDConvertLinkResultVO pddUrl = PinDuoDuoApiUtil.convert(goodsDetail.getGoodsSign(), |
| | |
| | | tokenSet.addAll(tokenList); |
| | | Map<String, String> tokenMap = new HashMap<>(); |
| | | for (String token : tokenSet) { |
| | | Long auctionId = taoBaoTokenAuctionIdMapManager.getAuctionIdByToken(token); |
| | | String auctionId = taoBaoTokenAuctionIdMapManager.getAuctionIdByToken(token); |
| | | if (auctionId == null) |
| | | throw new Exception("从淘口令获取商品失败"); |
| | | TaoBaoGoodsBrief simpleGoods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId); |
| | |
| | | |
| | | |
| | | if (simpleGoods.getMaterialLibType() != null && simpleGoods.getMaterialLibType() == 1) { |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | specialPid), specialId, null); |
| | |
| | | } else { |
| | | String sRelationId = taoBaoBuyRelationMapService.getRelationId(uid); |
| | | |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, |
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCouponV2(auctionId, |
| | | new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, |
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, |
| | | specialRelationPid), specialId, null); |
| | |
| | | return dto; |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args){ |
| | | |
| | | String newText = "【天猫】双11-预售玩法会场!做任务,赢最高16元红包!\n" + |
| | | "復製本条{淘宝活动:20150318020016625},进入【Ta0宝】立即抢购!"; |
| | | // 解析淘宝官方活动ID |
| | | List<String> list = new ConvertLinkManager(). getTaoBaoOfficialActivityId(newText); |
| | | if (list.size() > 0) { |
| | | String relationId = null; |
| | | for (String st : list) { |
| | | String activityid = st.replace("{淘宝活动:", "").replace("}", ""); |
| | | if (!StringUtil.isNullOrEmpty(activityid)) { |
| | | String adzoneId = "mm_124933865_56750082_89555600043".split("_")[3]; |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert(adzoneId, |
| | | activityid, relationId); |
| | | String link = dto.getShort_click_url(); |
| | | if (StringUtil.isNullOrEmpty(link)) { |
| | | link = dto.getClick_url(); |
| | | } |
| | | |
| | | String token = TaoKeApiUtil.getTKToken("http://", "淘宝官方活动", link, true); |
| | | newText = newText.replace(st, TaoBaoUtil.filterTaoToken(token)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |