| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.*; |
| | |
| | | return; |
| | | } |
| | | |
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | } catch (PDDApiException e1) { |
| | | } |
| | | } |
| | | } |
| | | if (pddGoods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在")); |
| | | return; |
| | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDPromotionUrl convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | if (convertUrl != null) |
| | | couponInfo.setLink(convertUrl.getUrl()); |
| | | } |
| | |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | final PDDGoodsDetail fGoods=pddGoods; |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | | try { |
| | | scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods); |
| | | scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), fGoods); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | goodsEvaluateService.updatePDDGoods(pddGoods); |
| | | goodsEvaluateService.updatePDDGoods(fGoods); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | //TODO 是否需要返回绑定链接 |
| | | String customParams = pddAuthService.getFanliCustomParams(uid); |
| | | boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, pid + "", customParams, !auth); |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), pid + "", customParams, !auth); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", convertUrl.getUrl()); |