| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, String specialId, Long auctionId) throws ShareGoodsException {
|
| | | public TaoBaoLink getTaoLiJinLinkForBuy(Long uid, String specialId, Long auctionId, String pid)
|
| | | throws ShareGoodsException {
|
| | | if (uid == null || uid <= 0) {
|
| | | throw new ShareGoodsException(1, "用户ID不能为空");
|
| | | }
|
| | |
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | | if (pid == null)
|
| | | app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
|
| | | else
|
| | | app.setPid(pid);
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.specialConvertCoupon(auctionId, app);
|
| | | if (goods == null) {
|
| | | throw new ShareGoodsException(1, "");
|
| | |
| | |
|
| | | boolean canBuy = userTLJBuyHistoryService.canBuy(uid, auctionId);
|
| | | if (!canBuy) {
|
| | | throw new ShareGoodsException(3, "同一商品每日只能领取三次");
|
| | | throw new ShareGoodsException(3, "立减红包已抢光,请稍后再试");
|
| | | }
|
| | |
|
| | | long currentTime = System.currentTimeMillis();
|
| | |
| | | taoLiJinDTO = TaoKeApiUtil.createTaoLiJin(auctionId, "自购立减", perface, 1, new Date(currentTime), sendEndTime,
|
| | | new Date(currentTime), sendEndTime, app);
|
| | | } catch (TaoKeApiException e) {
|
| | | LogHelper.errorDetailInfo(e, e.getMessage(), null);
|
| | | throw new ShareGoodsException(5, "生成推广链接失败");
|
| | | }
|
| | | if (taoLiJinDTO == null)
|