| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "createShareInfo")
|
| | | public void createShareInfo(AcceptData acceptData, Long uid, Long auctionId, String source, Integer totalNum,
|
| | | public void createShareInfo(AcceptData acceptData, Long uid, Long goodsId, String source, Integer totalNum,
|
| | | Integer goodsType, HttpServletRequest request, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户ID不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (auctionId == null || auctionId <= 0) {
|
| | | if (goodsId == null || goodsId <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品ID不能为空"));
|
| | | return;
|
| | | }
|
| | |
| | |
|
| | | if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | | // 京东
|
| | | createJDShare(acceptData, uid, auctionId, source, out);
|
| | | createJDShare(acceptData, uid, goodsId, source, out);
|
| | | return;
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | | // 拼多多
|
| | | createPDDShare(acceptData, uid, auctionId, source, out);
|
| | | createPDDShare(acceptData, uid, goodsId, source, out);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | relationId = extraInfo.getRelationId();
|
| | |
|
| | | if (source != null && "taolijin".equals(source)) {
|
| | | createTaoLijin(uid, auctionId, totalNum, relationId, request, out);
|
| | | createTaoLijin(uid, goodsId, totalNum, relationId, request, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, goodsId, relationId);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
|
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | auctionId + "");
|
| | | goodsId + "");
|
| | |
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | | if (!StringUtil.isNullOrEmpty(shortLink)) {
|
| | |
| | |
|
| | | data.put("clickUrl", url);
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | data.put("rule",
|
| | | "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("rule", configService.get("share_rule_link_tb"));
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | String shareText = "";
|
| | |
| | |
|
| | | data.put("shareMoney", "¥" + shareMoney.toString());
|
| | | try {
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO);
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, goodsId, Constant.SOURCE_TYPE_TAOBAO);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | });
|
| | | return;
|
| | | } catch (ShareGoodsException e) {
|
| | | LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+auctionId, "");
|
| | | LogHelper.errorDetailInfo(e, "分享出错:uid:"+uid+"auctionId:"+goodsId, "");
|
| | | // 分享出错报警
|
| | | try {
|
| | | monitorService.addClientAPIMonitor(MonitorFactory.createClientAPI(request, e.getCode(), 0, "分享出错"));
|
| | | } catch (Exception e1) {
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(auctionId + ""));
|
| | | businessEmergent110Service.shareTaoBaoGoodsError(StringUtil.Md5(goodsId + ""));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | |
| | | data.put("rule", "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("rule", configService.get("share_rule_link_tb"));
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | |
| | | Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
|
| | | goodsId + "", Constant.SOURCE_TYPE_JD);
|
| | |
|
| | | // 券短连接
|
| | | String shortLink = HttpUtil.getShortLink(url);
|
| | | if (!StringUtil.isNullOrEmpty(shortLink)) {
|
| | | url = shortLink;
|
| | | }
|
| | |
|
| | | data.put("clickUrl", url);
|
| | | // 帮助中心-介绍
|
| | | String rule = "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0";
|
| | | data.put("rule", rule);
|
| | | data.put("rule", configService.get("share_rule_link_jd"));
|
| | | data.put("pictUrl", jdGoods.getPicUrl());
|
| | |
|
| | | String shareText = "";
|
| | |
|
| | | String shopType = "京东价";
|
| | |
|
| | | // 无券
|
| | | // 分享模板
|
| | | JDCouponInfo couponInfo = jdGoods.getCouponInfo();
|
| | | if (couponInfo == null) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | if (StringUtil.isNullOrEmpty(text)) {
|
| | | text = configService.get("goods_share_text_nocoupon");
|
| | | }
|
| | | shareText = text.replace("{标题}", jdGoods.getSkuName()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(jdGoods.getPrice()) + "");
|
| | | } else// 有券
|
| | |
| | | .replace("{月销量}", JDUtil.getSaleCount(jdGoods.getInOrderCount30Days()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", null);
|
| | | data.put("shareText", shareText);
|
| | | |
| | | |
| | | String descText = shareText.replace(jdGoods.getSkuName(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | | descText = descText.substring(0);
|
| | |
| | | int p = (int) (array.size() * Math.random());
|
| | | if (p < array.size())
|
| | | data.put("notifyPicture", array.optString(p));
|
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | | data.put("notifyDesc", configService.get("goods_share_notify_jd"));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq&goodsType=%s", configService.getH5Host(),
|
| | |
| | |
|
| | | data.put("clickUrl", url);
|
| | | // 帮助中心-介绍
|
| | | String rule = "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0";
|
| | | data.put("rule", rule);
|
| | | data.put("rule", configService.get("share_rule_link_pdd"));
|
| | | data.put("pictUrl", goods.getGoodsImageUrl());
|
| | |
|
| | | String shareText = "";
|
| | |
| | | int p = (int) (array.size() * Math.random());
|
| | | if (p < array.size())
|
| | | data.put("notifyPicture", array.optString(p));
|
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | | |
| | | data.put("notifyDesc", configService.get("goods_share_notify_pdd"));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|