From dd9fd78aec975c29d6c5ea4c802aca2b7f773d91 Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期四, 27 二月 2020 14:00:43 +0800 Subject: [PATCH] 转链修改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java | 90 +++++++++++++++++++++++++++++---------------- 1 files changed, 58 insertions(+), 32 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 e42cbf1..5cc9e93 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 @@ -162,21 +162,21 @@ BigDecimal fanliMoney) { List<ShareGoodsCommentChoiceInfo> list = new ArrayList<>(); if (!StringUtil.isNullOrEmpty(token)) - list.add( - new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_TOKEN, "娣樺彛浠�", token, true, false)); + list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_TOKEN, "娣樺彛浠�", + String.format("寰╄=杩欐潯%s\n杩涘叆銆怲ao瀹濄�戝嵆鍙姠璐�", token), true, false)); if (!StringUtil.isNullOrEmpty(link)) { list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_LINK, "閾炬帴", link, true, false)); } if (!StringUtil.isNullOrEmpty(inviteCode)) { - list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_INVITE_CODE, "閭�璇风爜", inviteCode, - false, true)); + list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_INVITE_CODE, "閭�璇风爜", + "閭�璇风爜锛�" + inviteCode, false, true)); } list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_DOWNLOAD_LINK, "涓嬭浇閾炬帴", - "http://www.baidu.com", false, true)); + "涓嬭浇閾炬帴锛�" + Constant.YINGYONGBAO_LINK, false, true)); list.add(new ShareGoodsCommentChoiceInfo(ShareGoodsCommentChoiceInfo.TYPE_FANLI_MONEY, "杩斿埄閲戦", - "楼 " + fanliMoney, false, true)); + "杩斿埄閲戦锛毬� " + fanliMoney, false, true)); return list; } @@ -413,10 +413,13 @@ String imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs.getKey()); JSONArray array = JSONArray.fromObject(imgs); - int p = (int) (array.size() * Math.random()); - if (p < array.size()) { - shareInfo.setNotifyPicture(array.optString(p)); - } + shareInfo.setNotifyPicture(array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.optString(0)); + shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotify.getKey())); // 娣诲姞鍒嗕韩璁板綍 @@ -562,13 +565,16 @@ taoBaoLink.getGoods(), shareInfo.getToken())); // 鎻愮ず鍥炬枃鍐呭 - String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), platform, - Integer.parseInt(version)); + String imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs.getKey()); JSONArray array = JSONArray.fromObject(imgs); - int p = (int) (array.size() * Math.random()); - if (p < array.size()) { - shareInfo.setNotifyPicture(array.optString(p)); - } + + shareInfo.setNotifyPicture(array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.optString(0)); + shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotify.getKey())); // 鍒嗕韩閲戦 @@ -590,11 +596,17 @@ } // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(shareInfo.getToken(), null, inviteCode, + shareInfo.setCommentTextChoiceList(getCommentChoiceList(shareInfo.getShareText(), null, inviteCode, TaoBaoUtil.getGoodsHongBaoMoney(taoBaoLink.getGoods(), hongBaoManageService.getFanLiRate()))); - shareInfo.setCommentText(shareInfo.getShareText()); - shareInfo.setRecommendText(shareInfo.getDescText()); + + if (VersionUtil.greaterThan_2_0_7(platform, version)) { + String recommend = taoBaoLink.getGoods().getTitle(); + if (!StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getDescription())) + recommend += "\n\r" + taoBaoLink.getGoods().getDescription(); + shareInfo.setRecommendText(recommend); + } else + shareInfo.setRecommendText(shareInfo.getDescText()); out.print(JsonUtil.loadTrueResult( JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); @@ -708,10 +720,14 @@ String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); JSONArray array = JSONArray.fromObject(imgs); - int p = (int) (array.size() * Math.random()); - if (p < array.size()) { - shareInfo.setNotifyPicture(array.optString(p)); - } + + shareInfo.setNotifyPicture(array.size() > 1 ? array.optString(1) : array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.size() > 1 ? array.optString(1) : array.optString(0)); + shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotifyJD.getKey())); // 娣诲姞鍒嗕韩璁板綍 @@ -733,11 +749,14 @@ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getClickUrl(), inviteCode, + shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getShareText(), inviteCode, JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getFanLiRate()))); shareInfo.setCommentText(shareInfo.getShareText()); - shareInfo.setRecommendText(shareInfo.getDescText()); + if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) + shareInfo.setRecommendText(jdGoods.getSkuName()); + else + shareInfo.setRecommendText(shareInfo.getDescText()); out.print(JsonUtil.loadTrueResult( JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); @@ -842,13 +861,17 @@ shareInfo.setDescText(descText); // - String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), acceptData.getPlatform(), + String imgs = configService.getByVersion(ConfigKeyEnum.goodsShareNotifyImgs.getKey(), acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); JSONArray array = JSONArray.fromObject(imgs); - int p = (int) (array.size() * Math.random()); - if (p < array.size()) { - shareInfo.setNotifyPicture(array.optString(p)); - } + + shareInfo.setNotifyPicture(array.size() > 1 ? array.optString(1) : array.optString(0)); + + // 2.0.7鐗堟湰鍚庣殑鎻愮ず鍥剧墖 + imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs207.getKey()); + array = JSONArray.fromObject(imgs); + shareInfo.setNotifyPictureNew(array.size() > 1 ? array.optString(1) : array.optString(0)); + shareInfo.setNotifyDesc(configService.get(ConfigKeyEnum.goodsShareNotifyPDD.getKey())); // 娣诲姞鍒嗕韩璁板綍 @@ -871,11 +894,14 @@ String inviteCode = userInfoExtraService.getInviteCodeByUid(uid); // 璁剧疆璇勮鏂囨湰閫夐」 - shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getClickUrl(), inviteCode, + shareInfo.setCommentTextChoiceList(getCommentChoiceList(null, shareInfo.getShareText(), inviteCode, PinDuoDuoUtil.getGoodsFanLiMoney(goods, hongBaoManageService.getFanLiRate()))); shareInfo.setCommentText(shareInfo.getShareText()); - shareInfo.setRecommendText(shareInfo.getDescText()); + if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) + shareInfo.setRecommendText(goods.getGoodsName()); + else + shareInfo.setRecommendText(shareInfo.getDescText()); out.print(JsonUtil.loadTrueResult( JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create().toJson(shareInfo))); -- Gitblit v1.8.0