From 3fc84b5d4b36ce9ab5cea84ee1b54942c8e04ef9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 08 八月 2019 16:55:52 +0800 Subject: [PATCH] 拼多多短链修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java | 72 +++++++++++++++++++++++++++-------- 1 files changed, 55 insertions(+), 17 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java index a714a4f..ed7f834 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/GoodsController.java @@ -19,6 +19,7 @@ import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoLink; import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig; +import com.yeshi.fanli.exception.ShareGoodsException; import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.service.inter.goods.ShareGoodsService; @@ -70,14 +71,31 @@ @Resource private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService; - + @Resource private UserInfoExtraService userInfoExtraService; - + @Resource private UserTaoLiJinRecordService userTaoLiJinRecordService; - - + + private void doTaoLiJinBuy(Long uid, Long auctionId, PrintWriter out) { + JSONObject data = new JSONObject(); + TaoBaoLink taoBaoLink; + try { + taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuyWithOutFanLi(uid, auctionId); + } catch (ShareGoodsException e) { + out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage())); + return; + } + data.put("native", true); + JSONObject link = new JSONObject(); + link.put("clickUrl", taoBaoLink.getClickUrl()); + link.put("couponUrl", taoBaoLink.getCouponLink()); + data.put("type", 1); + data.put("link", link); + out.print(JsonUtil.loadTrueResult(data)); + } + /** * 鑾峰彇娣樺疂鐨勫垎浜摼鎺� * @@ -89,7 +107,7 @@ */ @RequestMapping(value = "gettaobaolink") public void getTaoBaoLink(AcceptData acceptData, Long uid, Long auctionId, String from, String source, - HttpServletRequest request, PrintWriter out) { + HttpServletRequest request, PrintWriter out) { if (uid == null || uid <= 0) { out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛ID涓嶈兘涓虹┖")); return; @@ -119,6 +137,11 @@ } catch (Exception e1) { e1.printStackTrace(); } + } + + if ("taolijin_buy".equalsIgnoreCase(source)) { + doTaoLiJinBuy(uid, auctionId, out); + return; } JSONObject data = new JSONObject(); @@ -159,24 +182,26 @@ pidType = PidUser.TYPE_FANLI_IOS; try { TaoBaoLink taoBaoLink = null; + // 鏄繑鍒╁晢鍝佸簱鐨勫晢鍝� if (specialConvert) { if (!StringUtil.isNullOrEmpty(specialId)) { if (source != null && "taolijin".equals(source)) { boolean isNewUser = userInfoExtraService.isNewUser(uid); if (isNewUser) { - // 鍒ゅ畾涓鸿�佺敤鎴凤細 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� + // 鍒ゅ畾涓鸿�佺敤鎴凤細 + // 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� long countRecord = userTaoLiJinRecordService.countRecordByUid(uid); if (countRecord == 0) { - taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId); + taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, null); } } - } - + } + if (taoBaoLink == null) { taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId); } - + data.put("native", true); } else { if (!specialConvert && !isNative) { @@ -198,8 +223,22 @@ LogHelper.errorDetailInfo(e, "uid:" + uid, null); } if (!StringUtil.isNullOrEmpty(relationId)) {// - taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId, - TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID); + if (source != null && "taolijin".equals(source)) { + boolean isNewUser = userInfoExtraService.isNewUser(uid); + if (isNewUser) { + // 鍒ゅ畾涓鸿�佺敤鎴凤細 + // 鏂颁汉鍙浣跨敤浜嗘柊浜虹孩鍖咃紝涔熷氨鏄偅1鍧楅挶锛岄偅涔堬紝浠栫湅鍒扮殑鍒嗕韩鐖嗘涓殑鍟嗗搧-灏卞彧鑳藉垎浜�� + long countRecord = userTaoLiJinRecordService.countRecordByUid(uid); + if (countRecord == 0) { + taoBaoLink = shareGoodsService.getTaoLiJinLinkForBuy(uid, specialId, auctionId, + TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID); + } + } + } else { + taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId, + TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID); + } + data.put("native", true); } else { if (pidType == PidUser.TYPE_FANLI_ANDROID) @@ -220,6 +259,9 @@ out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { + + LogHelper.errorDetailInfo(e); + isNative = false; try { monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, 0, 0, "璐拱娣樺疂鍟嗗搧杞摼鍑洪敊")); @@ -255,7 +297,6 @@ data.put("type", 1); data.put("link", link); data.put("native", true); - } catch (Exception e1) { String siteId = tbPid.getPid().split("_")[2]; String adzoneId = tbPid.getPid().split("_")[3]; @@ -273,10 +314,7 @@ businessEmergent110Service.buyTaoBaoGoodsError(StringUtil.Md5(auctionId + "")); } - } - - - + } /** * 鏄惁鍦ㄥ弬涓庢帹骞� -- Gitblit v1.8.0