| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.yeshi.fanli.entity.SystemEnum;
|
| | | import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException;
|
| | | import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | |
|
| | | @Resource
|
| | | private ShareGoodsService shareGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoLinkManager taoBaoLinkManager;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | | }
|
| | |
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | createTaoLijin(uid, auctionId, totalNum, relationId, request, out);
|
| | | createTaoLijin(uid, auctionId, totalNum, relationId,acceptData.getSystem(), request, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | | TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(uid, auctionId, relationId,null);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | auctionId + "");
|
| | |
|
| | |
| | |
|
| | | data.put("clickUrl", url);
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("rule", configService.get(ConfigKeyEnum.shareSingleGoodsRule.getKey()));
|
| | | data.put("rule", configService.getValue(ConfigKeyEnum.shareSingleGoodsRule.getKey(),acceptData.getSystem()));
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | String shareText = "";
|
| | |
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get(ConfigKeyEnum.goodsShareTextNoCoupon.getKey());
|
| | | text = configService.getValue(ConfigKeyEnum.goodsShareTextNoCoupon.getKey(),acceptData.getSystem());
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "");
|
| | | } else// 有券
|
| | | {
|
| | | String text = shareGoodsTextTemplateService.geteCouponTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get(ConfigKeyEnum.goodsShareTextCoupon.getKey());
|
| | | text = configService.getValue(ConfigKeyEnum.goodsShareTextCoupon.getKey(),acceptData.getSystem());
|
| | |
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle())
|
| | | .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "")
|
| | |
| | | descText = descText.substring(0);
|
| | | data.put("descText", descText);
|
| | | //
|
| | | String imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs.getKey());
|
| | | String imgs = configService.getValue(ConfigKeyEnum.goodsShareNotifyImgs.getKey(),acceptData.getSystem());
|
| | | JSONArray array = JSONArray.fromObject(imgs);
|
| | | int p = (int) (array.size() * Math.random());
|
| | | if (p < array.size())
|
| | | data.put("notifyPicture", array.optString(p));
|
| | | data.put("notifyDesc", configService.get(ConfigKeyEnum.goodsShareNotify.getKey()));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),acceptData.getSystem()));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | |
| | | }
|
| | | });
|
| | | return;
|
| | | } catch (ShareGoodsException e) {
|
| | | } catch (TaoBaoConvertLinkException e) {
|
| | | LogHelper.errorDetailInfo(e, "分享出错:uid:" + uid + "auctionId:" + auctionId, "");
|
| | | // 分享出错报警
|
| | | try {
|
| | |
| | | } catch (Exception e1) {
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""),acceptData.getSystem());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | public void createTaoLijin(Long uid, Long auctionId, int totalNum, String relationId, SystemEnum system, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoLiJinLinkForShare(uid, auctionId, relationId);
|
| | | TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoLiJinLinkForShare(uid, auctionId, relationId,null);
|
| | |
|
| | | TaoBaoGoodsBrief goods = taoBaoLink.getGoods();
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq&tid=%s", configService.getH5Host(),
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq&tid=%s", configService.getH5Host(system),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | auctionId + "", AESUtil.encrypt(tljId + "", Constant.UIDAESKEY));
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | |
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | data.put("rule",
|
| | | "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | "http://apph5.banliapp.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | |
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get(ConfigKeyEnum.goodsShareTextNoCoupon.getKey());
|
| | | text = configService.getValue(ConfigKeyEnum.goodsShareTextNoCoupon.getKey(),system);
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "");
|
| | | } else// 有券
|
| | |
| | | descText = descText.substring(0);
|
| | | data.put("descText", descText);
|
| | |
|
| | | String imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs.getKey());
|
| | | String imgs = configService.getValue(ConfigKeyEnum.goodsShareNotifyImgs.getKey(),system);
|
| | | JSONArray array = JSONArray.fromObject(imgs);
|
| | | int p = (int) (array.size() * Math.random());
|
| | | if (p < array.size())
|
| | | data.put("notifyPicture", array.optString(p));
|
| | | data.put("notifyDesc", configService.get(ConfigKeyEnum.goodsShareNotify.getKey()));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),system));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | |
| | | }
|
| | | });
|
| | | return;
|
| | | } catch (ShareGoodsException e) {
|
| | | } catch (TaoBaoConvertLinkException e) {
|
| | | LogHelper.errorDetailInfo(e, "分享出错:uid:" + uid + "auctionId:" + auctionId, "");
|
| | | // 分享出错报警
|
| | | try {
|
| | |
| | | } catch (Exception e1) {
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""),system);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | });
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = getShareTemplate(uid, hasCoupon, tljId);
|
| | | template = getShareTemplate(uid, hasCoupon, tljId,acceptData.getSystem());
|
| | |
|
| | | // 校验券模板是否正确
|
| | | if (hasCoupon) {
|
| | |
| | | }
|
| | | url = userTaoLiJinRecord.getSendUrl();
|
| | | } else {
|
| | | url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | goods.getAuctionId() + "");
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | | private String getShareTemplate(Long uid, boolean hasCoupon, Long tljId) {
|
| | | private String getShareTemplate(Long uid, boolean hasCoupon, Long tljId,SystemEnum system) {
|
| | | if (hasCoupon) {
|
| | | if (tljId != null) {
|
| | | String template = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid);
|
| | |
| | | } else {
|
| | | String template = shareGoodsTextTemplateService.geteCouponTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configService.get(ConfigKeyEnum.goodsShareTextCoupon.getKey());
|
| | | template = configService.getValue(ConfigKeyEnum.goodsShareTextCoupon.getKey(),system);
|
| | | return template;
|
| | | }
|
| | |
|
| | | } else {
|
| | | String template = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configService.get(ConfigKeyEnum.goodsShareTextNoCoupon.getKey());
|
| | | template = configService.getValue(ConfigKeyEnum.goodsShareTextNoCoupon.getKey(),system);
|
| | | return template;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("template", getShareTemplate(uid, hasCoupon, tljId));
|
| | | data.put("template", getShareTemplate(uid, hasCoupon, tljId,acceptData.getSystem()));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | if (tljId != null) {
|
| | | out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules", new Date())));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(configService.get(ConfigKeyEnum.shareGoodsTemplateRules.getKey())));
|
| | | out.print(JsonUtil.loadTrueResult(configService.getValue(ConfigKeyEnum.shareGoodsTemplateRules.getKey(),acceptData.getSystem())));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * 查询顶部分类
|
| | | *
|
| | | * @param acceptData
|
| | | * @param page
|
| | | * @param cid
|
| | | * @param id
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "shareDynamic", method = RequestMethod.POST)
|
| | |
| | | data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())).toString());
|
| | |
|
| | | // 分享提醒
|
| | | data.put("notifyDesc", configService.get(ConfigKeyEnum.goodsShareNotify.getKey()));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),acceptData.getSystem()));
|
| | |
|
| | | // 分享提示语
|
| | | String imgs = configService.get(ConfigKeyEnum.goodsShareNotifyImgs.getKey());
|
| | | String imgs = configService.getValue(ConfigKeyEnum.goodsShareNotifyImgs.getKey(),acceptData.getSystem());
|
| | | JSONArray array = JSONArray.fromObject(imgs);
|
| | | int p = (int) (array.size() * Math.random());
|
| | | if (p < array.size()) {
|
| | |
| | |
|
| | | // 帮助链接
|
| | | data.put("helpLink",
|
| | | "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | "http://apph5.banliapp.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | |
|
| | | if (cid == 2) { // 2 推荐好货
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordDynamic(uid,
|
| | |
| | |
|
| | | Long auctionId = dynamicInfo.getImgs().get(0).getGoods().getAuctionId();
|
| | | // 商品分享链接
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(acceptData.getSystem()),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(),
|
| | | AESUtil.encrypt(uid + "", Constant.UIDAESKEY), auctionId + "");
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | |
| | | && extraInfo.getRelationValid() == true) {
|
| | | relationId = extraInfo.getRelationId();
|
| | | }
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | | TaoBaoLink taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(uid, auctionId, relationId,null);
|
| | | TaoBaoGoodsBrief goods = taoBaoLink.getGoods();
|
| | | if (!com.yeshi.fanli.util.VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(),
|
| | | acceptData.getVersion()))
|
| | | data.put("clickUrl", ShareControllerV2.getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), goods, taoBaoLink.getTaoToken()));
|
| | | data.put("clickUrl",
|
| | | ShareControllerV2.getERCodeContentNew(
|
| | | configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),acceptData.getSystem()), goods,
|
| | | taoBaoLink.getTaoToken()));
|
| | |
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | // 测试
|
| | | List<String> commentTexts = new ArrayList<>();
|
| | | String commentTextStr = configService.get(ConfigKeyEnum.shareSingleGoodsCommentText.getKey());
|
| | | String commentTextStr = configService.getValue(ConfigKeyEnum.shareSingleGoodsCommentText.getKey(),acceptData.getSystem());
|
| | | if (!StringUtil.isNullOrEmpty(commentTextStr)) {
|
| | | JSONArray arr = JSONArray.fromObject(commentTextStr);
|
| | | for (int i = 0; i < arr.size(); i++) {
|
| | |
| | | }
|
| | | }
|
| | | data.put("commentTexts", commentTexts);
|
| | | data.put("wxErCode", ShareControllerV2.getERCodeContent(configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), goods, taoBaoLink.getTaoToken()));
|
| | | data.put("wxErCode",
|
| | | ShareControllerV2.getERCodeContentNew(
|
| | | configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),acceptData.getSystem()), goods,
|
| | | taoBaoLink.getTaoToken()));
|
| | | }
|
| | |
|
| | | } else if (cid == 4) { // 邀请分享
|
| | |
| | | String valueBr = valueN.replace("\n", "<br><br>");
|
| | | data.put("inviteRules", valueBr);
|
| | |
|
| | | // 邀请链接
|
| | | String shortLink = HttpUtil.getShortLink("http://" + Constant.wxGZConfig.getLoginHost() + "/"
|
| | | + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid);
|
| | | data.put("inviteLink", shortLink);
|
| | | data.put("inviteLink", Constant.YINGYONGBAO_LINK);
|
| | | data.put("inviteCode", inviteCode);
|
| | | data.put("helpLink", configService.get(ConfigKeyEnum.inviteHelpLink.getKey()));
|
| | | data.put("helpLink", configService.getValue(ConfigKeyEnum.inviteHelpLink.getKey(),acceptData.getSystem()));
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|