| | |
| | | package com.yeshi.fanli.controller.client.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.lang.reflect.Type;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | |
| | | 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;
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.controller.client.v2.ShareControllerV2;
|
| | | import com.yeshi.fanli.dto.share.ShareGoodsRecordDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsGroup;
|
| | |
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | |
|
| | | @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", taoBaoLink.getTaoToken());
|
| | | data.put("rule", configService.get("share_single_goods_rule"));
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("rule", configService.getValue(ConfigKeyEnum.shareSingleGoodsRule.getKey(),acceptData.getSystem()));
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | String shareText = "";
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO
|
| | | : TaoBaoConstant.SHARE_PRICE_TM;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get("goods_share_text_nocoupon");
|
| | | 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("goods_share_text_coupon");
|
| | | text = configService.getValue(ConfigKeyEnum.goodsShareTextCoupon.getKey(),acceptData.getSystem());
|
| | |
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle())
|
| | | .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "")
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("shareText", shareText);
|
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | | descText = descText.substring(0);
|
| | | data.put("descText", descText);
|
| | | //
|
| | | String imgs = configService.get("goods_share_notify_imgs");
|
| | | 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("goods_share_notify"));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),acceptData.getSystem()));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | |
| | |
|
| | | data.put("shareMoney", "¥" + shareMoney.toString());
|
| | | try {
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO, false);
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId,
|
| | | Constant.SOURCE_TYPE_TAOBAO, false);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | |
| | | }
|
| | | });
|
| | | 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();
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value",null);
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", null);
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, goods);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | 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);
|
| | |
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | }
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | 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));
|
| | |
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO
|
| | | : TaoBaoConstant.SHARE_PRICE_TM;
|
| | | String shareText = "";
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configService.get("goods_share_text_nocoupon");
|
| | | text = configService.getValue(ConfigKeyEnum.goodsShareTextNoCoupon.getKey(),system);
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle()).replace("{商品原价}",
|
| | | MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "");
|
| | | } else// 有券
|
| | | {
|
| | | String text = shareGoodsTextTemplateService.getTaoLiJinTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(text))
|
| | | text = configTaoLiJinService.getValueByKey("goods_share_text",new Date());
|
| | | text = configTaoLiJinService.getValueByKey("goods_share_text", new Date());
|
| | |
|
| | | shareText = text.replace("{标题}", taoBaoLink.getGoods().getTitle())
|
| | | .replace("{商品原价}", MoneyBigDecimalUtil.getWithNoZera(taoBaoLink.getGoods().getZkPrice()) + "")
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("shareText", shareText);
|
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | | descText = descText.substring(0);
|
| | | data.put("descText", descText);
|
| | |
|
| | | String imgs = configService.get("goods_share_notify_imgs");
|
| | | 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("goods_share_notify"));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),system));
|
| | |
|
| | | // 添加分享记录
|
| | | BigDecimal rate = hongBaoManageService.getShareRate();
|
| | |
| | |
|
| | | data.put("shareMoney", "¥" + shareMoney.toString());
|
| | | try {
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId, Constant.SOURCE_TYPE_TAOBAO, true);
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordGoodsDetail(uid, auctionId,
|
| | | Constant.SOURCE_TYPE_TAOBAO, true);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | |
| | | }
|
| | | });
|
| | | 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);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | List<UserShareGoodsRecord> list = new ArrayList<UserShareGoodsRecord>();
|
| | |
|
| | | long count = userShareGoodsRecordService.countQueryByUid(uid, source);
|
| | |
|
| | | if (count > 0) {
|
| | | list = userShareGoodsRecordService.getMyShareGoodsRecords((page - 1) * pageSize, pageSize, uid, source);
|
| | | }
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", list);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | | });
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("result_list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("加载失败"));
|
| | | e.printStackTrace();
|
| | |
| | | try {
|
| | | userShareGoodsRecordService.takeEffectShareRecord(acceptData, shareId);
|
| | | } catch (UserShareGoodsRecordException eu) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(eu);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | }
|
| | |
|
| | | 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);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configTaoLiJinService.getValueByKey("goods_share_text",new Date());
|
| | | template = configTaoLiJinService.getValueByKey("goods_share_text", new Date());
|
| | | return template;
|
| | | } else {
|
| | | String template = shareGoodsTextTemplateService.geteCouponTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configService.get("goods_share_text_coupon");
|
| | | template = configService.getValue(ConfigKeyEnum.goodsShareTextCoupon.getKey(),system);
|
| | | return template;
|
| | | }
|
| | |
|
| | | } else {
|
| | | String template = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | | if (StringUtil.isNullOrEmpty(template))
|
| | | template = configService.get("goods_share_text_nocoupon");
|
| | | 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));
|
| | | }
|
| | |
|
| | |
| | | @RequestMapping(value = "getShareTextTemplateRules", method = RequestMethod.POST)
|
| | | public void getShareTextTemplateRules(AcceptData acceptData, Long tljId, PrintWriter out) {
|
| | | if (tljId != null) {
|
| | | out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules",new Date())));
|
| | | out.print(JsonUtil.loadTrueResult(configTaoLiJinService.getValueByKey("share_goods_rules", new Date())));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(configService.get("share_goods_template_rules")));
|
| | | 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)
|
| | |
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | GoodsPicture goodsPicture = imgs.get(0);
|
| | | if (goodsPicture.getGoodState() == 1) {
|
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (goods.getState() != null && goods.getState() == 1) {
|
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (!goods.isCoupon()) {
|
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | | TaoKeApiUtil.getSimpleGoodsInfo(goods.getAuctionId());
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | out.print(JsonUtil.loadFalseResult("该商品已下架"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | } else {
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null || imgs.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("所有商品已抢光"));
|
| | | return;
|
| | | }
|
| | |
|
| | | int count = 0;
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | if (goodsPicture.getGoodState() == 1) {
|
| | | count++;
|
| | | continue;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | count++;
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (goods.getState() != null && goods.getState() == 1) {
|
| | | count++;
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (!goods.isCoupon()) {
|
| | | count++;
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | if (count >= imgs.size()) {
|
| | | out.print(JsonUtil.loadFalseResult("所有商品已抢光"));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | // 分享文字
|
| | |
| | | title = "给你推荐精选好物优惠券,购物前先领券,别错过优惠哦~";
|
| | | }
|
| | | data.put("title", title);
|
| | | data.put("content",String.format("我在%s发现了一个很好的商品,快来看看~",Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | | data.put("content", String.format("我在%s发现了一个很好的商品,快来看看~",
|
| | | Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion())));
|
| | |
|
| | | // 分享奖金
|
| | | ClientTextStyleVO desc = dynamicInfo.getDesc();
|
| | |
| | | data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())).toString());
|
| | |
|
| | | // 分享提醒
|
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | | data.put("notifyDesc", configService.getValue(ConfigKeyEnum.goodsShareNotify.getKey(),acceptData.getSystem()));
|
| | |
|
| | | // 分享提示语
|
| | | String imgs = configService.get("goods_share_notify_imgs");
|
| | | 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);
|
| | | if (!StringUtil.isNullOrEmpty(shortLink)) {
|
| | | url = shortLink;
|
| | | }
|
| | |
|
| | | data.put("clickUrl", url);
|
| | |
|
| | | // 淘宝口令
|
| | |
| | | && extraInfo.getRelationValid() == true) {
|
| | | relationId = extraInfo.getRelationId();
|
| | | }
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | 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.getERCodeContentNew(
|
| | | configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),acceptData.getSystem()), goods,
|
| | | taoBaoLink.getTaoToken()));
|
| | |
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | // 测试
|
| | | List<String> commentTexts = new ArrayList<>();
|
| | | 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++) {
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | if (arr.optString(i).contains("[邀请码]")) {
|
| | | continue;
|
| | | }
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(inviteCode))
|
| | | commentTexts.add(arr.optString(i).replace("[下载链接]", Constant.YINGYONGBAO_LINK)
|
| | | .replace("[淘口令]", data.optString("token")));
|
| | | else
|
| | | commentTexts.add(arr.optString(i).replace("[下载链接]", Constant.YINGYONGBAO_LINK)
|
| | | .replace("[邀请码]", inviteCode).replace("[淘口令]", data.optString("token")));
|
| | | }
|
| | | }
|
| | | data.put("commentTexts", commentTexts);
|
| | | data.put("wxErCode",
|
| | | ShareControllerV2.getERCodeContentNew(
|
| | | configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),acceptData.getSystem()), goods,
|
| | | taoBaoLink.getTaoToken()));
|
| | | }
|
| | |
|
| | | } else if (cid == 4) { // 邀请分享
|
| | |
|
| | | String inviteCode = null;
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
|
| | | inviteCode = userInfoExtra.getInviteCode();
|
| | | } else {
|
| | | String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
|
| | | if (StringUtil.isNullOrEmpty(inviteCode)) {
|
| | | out.print(JsonUtil.loadFalseResult(9001, "邀请码未激活"));
|
| | | return;
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | title = title.replace("【邀请码】", inviteCode);
|
| | | title = title.replace("【邀请链接】", UserUtil.getInviteShortLink(uid));
|
| | | title = title.replace("【邀请链接】", Constant.YINGYONGBAO_LINK);
|
| | | data.put("title", title);
|
| | |
|
| | | } else { // 有图分享
|
| | |
| | | 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("invite_help_link"));
|
| | | data.put("helpLink", configService.getValue(ConfigKeyEnum.inviteHelpLink.getKey(),acceptData.getSystem()));
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|