| | |
| | |
|
| | | import com.yeshi.fanli.dto.douyin.DouYinGoods;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
|
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | | import com.yeshi.fanli.util.suning.SuningApiUtil;
|
| | | import com.yeshi.fanli.util.suning.SuningUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.vipshop.VipShopApiUtil;
|
| | | import com.yeshi.fanli.util.vipshop.VipShopUtil;
|
| | | import com.yeshi.fanli.vo.msg.TokenVO;
|
| | | import com.yeshi.fanli.vo.search.GoodsDocParseResultVO;
|
| | |
|
| | |
| | | link = urlList.get(0);
|
| | | else// 第一个口令在第一个链接前面
|
| | | token = tokenList.get(0);
|
| | |
|
| | | } else if (typeSet.contains(ClipboardContentType.link) && typeSet.contains(ClipboardContentType.text)) {// 链接+文本
|
| | | link = urlList.get(0);
|
| | |
|
| | |
| | | if (!StringUtil.isNullOrEmpty(link)) {
|
| | | CommonGoods goods = parseLink(urlList.get(0));
|
| | | if (goods == null || goods.getGoodsId() == null) {
|
| | | if (urlList.size() > 1)
|
| | | if (tokenList.size() == 0 && urlList.size() == 2
|
| | | && urlList.get(0).indexOf("://uland.taobao.com") > -1
|
| | | && urlList.get(1).indexOf("?id=") > -1) {// 有2个链接的文案,第一个是店铺券链接,其中二个是淘宝商品详情
|
| | | CommonGoods goods1 = parseLink(urlList.get(1));
|
| | | if (goods1 != null && goods1.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | resultListener.onResult(goods1);
|
| | | } else {
|
| | | resultListener.onResult(new GoodsDocParseResultVO(text, urlList.get(0)));
|
| | | }
|
| | |
|
| | | } else if (urlList.size() > 1)
|
| | | resultListener.onResult(new GoodsDocParseResultVO(text, urlList.get(0)));
|
| | | else {// 单链接
|
| | | // 判断是否包含可转链的链接
|
| | |
| | | commonGoods.setPicture(goods.getGoodsThumbnailUrl());
|
| | | }
|
| | | }
|
| | | } else if (simpleGoods.getGoodsType() == Constant.SOURCE_TYPE_VIP) {
|
| | | VIPGoodsInfo goods = VipShopApiUtil.getGoodsDetail(simpleGoods.getGoodsId());
|
| | | if (goods != null) {
|
| | | commonGoods = CommonGoodsFactory.create(goods);
|
| | | }
|
| | | } else if (simpleGoods.getGoodsType() == Constant.SOURCE_TYPE_SUNING) {
|
| | | SuningGoodsInfo goods = SuningApiUtil.getGoodsDetail(simpleGoods.getGoodsId().split("-")[1],
|
| | | simpleGoods.getGoodsId().split("-")[0]);
|
| | | if (goods != null) {
|
| | | commonGoods = CommonGoodsFactory.create(goods);
|
| | | }
|
| | | }
|
| | |
|
| | | return commonGoods;
|
| | |
| | | if (!StringUtil.isNullOrEmpty(pddId)) {
|
| | | return new SimpleCommonGoods(pddId, Constant.SOURCE_TYPE_PDD);
|
| | | }
|
| | |
|
| | | // 解析苏宁
|
| | | String suningId = SuningUtil.parseGoodsIdByUrl(link);
|
| | | if (!StringUtil.isNullOrEmpty(suningId)) {
|
| | | return new SimpleCommonGoods(suningId, Constant.SOURCE_TYPE_SUNING);
|
| | | }
|
| | |
|
| | | // 解析唯品会
|
| | | String vipId = VipShopUtil.parseGoodsIdByUrl(link);
|
| | | if (!StringUtil.isNullOrEmpty(vipId)) {
|
| | | return new SimpleCommonGoods(vipId, Constant.SOURCE_TYPE_VIP);
|
| | | }
|
| | |
|
| | | // 解析淘宝
|
| | | String auctionId = parseTBAuctionIdFromLink(link);
|
| | | if (!StringUtil.isNullOrEmpty(auctionId)) {
|
| | |
| | | tb = TaoBaoUtil.parsePhoneShareUrlByTM(link);
|
| | | if (tb != null)
|
| | | auctionId = tb.getAuctionId() + "";
|
| | | } else if (link.contains("h5.m.taobao") || link.contains("detail.m.tmall")|| link.contains("item.taobao")
|
| | | } else if (link.contains("h5.m.taobao") || link.contains("detail.m.tmall") || link.contains("item.taobao")
|
| | | || link.contains("detail.tmall")) { // 手机页面和电脑页面
|
| | | Map<String, String> map = Utils.parseURL(link);
|
| | | String id = "";
|