From 5e7b0ed4a154ad067cbcf4aa1a1c7cce32f9864c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 26 四月 2024 18:02:17 +0800 Subject: [PATCH] 唯品会链接解析升级 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java index 8bbff8a..b1b4980 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java @@ -26,6 +26,7 @@ import com.yeshi.fanli.util.goods.douyin.DYUtil; import com.yeshi.fanli.util.goods.douyin.vo.DYConvertResult; import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; +import kafka.utils.Json; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -266,7 +267,12 @@ // 鎶栭煶 if (goodsType == Constant.SOURCE_TYPE_DY) { - createDYShare(acceptData, uid,Long.parseLong( goodsId), source, needGoods, out); + try { + createDYShare(acceptData, uid,Long.parseLong( goodsId), source, needGoods, out); + } catch (Exception e) { + out.print(JsonUtil.loadFalseResult("杞摼澶辫触")); + e.printStackTrace(); + } return; } @@ -351,6 +357,10 @@ createTaoLijin(uid, goodsId, totalNum, relationId, acceptData, request, out); return; } else {// 鏅�氬垎浜垱寤� + if("鐚滀綘鍠滄".equalsIgnoreCase(source)){ + out.print(JsonUtil.loadFalseResult(4, "鏆備笉鏀寔鍒嗕韩")); + return; + } createCommonTaoBaoShare(acceptData.getPlatform(), acceptData.getVersion(), goodsId, inviteCode, uid, needGoods, relationId, acceptData, out); return; @@ -1449,7 +1459,7 @@ * @Description: */ public void createDYShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods, - PrintWriter out) { + PrintWriter out) throws Exception { DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(goodsId); if (goods == null) { out.print(JsonUtil.loadFalseResult(1, "璇ュ晢鍝佸凡涓嬫灦")); @@ -1459,11 +1469,12 @@ SystemEnum system = SystemInfoUtil.getSystem(acceptData); - DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid), ""); + DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid), ""); + ShareInfoVO shareInfo = new ShareInfoVO(); - shareInfo.setClickUrl(convertResult.getQrCode()); - shareInfo.setWxErCode(convertResult.getQrCode()); + shareInfo.setClickUrl(convertResult.getZlink()); + shareInfo.setWxErCode(convertResult.getZlink()); shareInfo.setCommentTexts(new ArrayList<>()); shareInfo.setRule(configService.getValue(ConfigKeyEnum.shareRuleLinkDY.getKey(), system)); shareInfo.setPictUrl(goods.getCover()); @@ -1904,7 +1915,13 @@ return; } - DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(),DYUtil.createShareExtraInfo(uid),""); + DYConvertResult convertResult = null; + try { + convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid),""); + } catch (Exception e) { + out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧杞摼澶辫触")); + return; + } // 鐢熸垚鏅�氬垎浜唴瀹� -- Gitblit v1.8.0