From f4548a3ee46afe45da4ee2a42dc169c575deee9f Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期三, 31 七月 2019 11:57:36 +0800 Subject: [PATCH] 动态v2兼容 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java | 287 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 174 insertions(+), 113 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java index 6ad6d98..9301a50 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java @@ -75,6 +75,7 @@ import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.taobao.TaoLiJinUtil; +import com.yeshi.fanli.vo.goods.CouponInfoVO; import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO; import com.yeshi.fanli.vo.goods.GoodsDetailVO; import com.yeshi.fanli.vo.goods.MoneyInfoVO; @@ -156,19 +157,19 @@ @Resource private TLJBuyGoodsService tljBuyGoodsService; - + @Resource private UserInfoService userInfoService; - + @Resource private JDGoodsCacheUtil jdGoodsCacheUtil; @Resource private PinDuoDuoCacheUtil pinDuoDuoCacheUtil; - /** * 娣樺疂鍟嗗搧璇︽儏 + * * @param acceptData * @param id * @param uid @@ -181,7 +182,7 @@ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧id涓嶈兘涓虹┖")); return; } - + BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages()); if (system == null) { @@ -326,12 +327,11 @@ } catch (Exception e) { LogHelper.errorDetailInfo(e); } - - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate); - + // 搴楅摵淇℃伅 TaoBaoShop shop = taoBaoShopService.getTaoBaoShop(id, goods.getSellerId()); if (shop != null) { @@ -341,7 +341,7 @@ } goodsDetail.setShopInfo(ShopInfoVOFactory.convertTaoBaoShop(shop)); } - + // 鏈夊埜澶勭悊 if (goodsDetail.isHasCoupon()) { if (!StringUtil.isNullOrEmpty(from)) { @@ -352,22 +352,22 @@ } } } - + extraVO.setTbPidInfo(clientTBPid); extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img.html?id=" + id); - + // 鍒嗕韩璧氫汉鎻愮ず MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); List<ShamUser> listShareUser = new ArrayList<ShamUser>(); if (moneyInfo != null) { String shareMoney = moneyInfo.getShareMoney(); if (goods.getBiz30day() >= 1000) { - listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1, 5); + listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney.replaceAll("楼", "")), 1, + 5); } } extraVO.setListShareUser(listShareUser); - - + // 棰嗗埜浜哄垪琛� List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && goods.getCouponAmount() != null @@ -377,8 +377,7 @@ } } extraVO.setListCouponUser(listCouponUser); - - + if (uid != null) { // 鏄惁鍔犲叆鏀惰棌 CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id, @@ -388,17 +387,15 @@ extraVO.setStorage(userGoodsStorageService.isExistStorage(uid, id, Constant.SOURCE_TYPE_TAOBAO)); } - // 娴嬭瘯 SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, "goods_detail_jump_taobao"); if ("1".equalsIgnoreCase((params.getValue() + "").trim())) { extraVO.setIsNative(true); - } + } - // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), id + ""); + String h5Url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePath(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -409,7 +406,7 @@ boolean fanliValid = true; boolean shareValid = true; int moneyType = 1; - + // 鎺ㄥ箍绾㈠寘 if (from != null && from.equals("taolijin")) { // 璁$畻鎺ㄥ箍绾㈠寘 @@ -439,7 +436,7 @@ moneyType = 2; fanliValid = false; spreadHongBao.setMoney(spreadMoney.toString()); - + ClientTextStyleVO textStyleVO1 = new ClientTextStyleVO(); textStyleVO1.setContent("鍒嗕韩"); textStyleVO1.setColor("#666666"); @@ -460,7 +457,7 @@ listText.add(textStyleVO4); extraVO.setTip(listText); } - + spreadHongBao.setName("鎺ㄥ箍绾㈠寘 "); spreadHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); OtherInfo otherInfo = new OtherInfo(); @@ -489,39 +486,35 @@ fanliValid = true; shareValid = false; helpLink = configService.get("zigoulijian_nofanli_help"); - + String tljHongBao = TaoBaoUtil.getGoodsHongBaoMoney(goods, new BigDecimal(70)).toString(); - + ReduceHongBao reduceHongBao = new ReduceHongBao(); reduceHongBao.setLeft(buyGoods.getLeftHongBaoCount()); reduceHongBao.setMoney(tljHongBao); reduceHongBao.setName("浠樻绔嬪噺 "); reduceHongBao.setTip("褰撴棩棰嗗彇锛屽綋鏃ュ唴浣跨敤锛岃繃鏈熷け鏁�"); reduceHongBao.setTotal(buyGoods.getTotalHongBaoCount()); - - + OtherInfo otherInfo = new OtherInfo(); otherInfo.setReduceHongBao(reduceHongBao); goodsDetail.setOtherInfo(otherInfo); } extraVO.setFanliValid(fanliValid); extraVO.setShareValid(shareValid); - + MoneyInfoVO goodsMoney = goodsDetail.getMoneyInfo(); if (goodsMoney != null) { goodsMoney.setMoneyType(moneyType); } - - + // 鍒嗕韩璺緞 if (StringUtil.isNullOrEmpty(helpLink)) { helpLink = configService.get("no_rebate_help_link"); } - + // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl()); ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -542,7 +535,6 @@ } }); } - /** * 浜笢鍟嗗搧璇︽儏 @@ -566,26 +558,35 @@ JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 楂樼骇鎺ュ彛 if (jdGoods == null) { jdGoods = JDUtil.getGoodsDetail(id); // 鐖彇缃戦〉 - //jdGoods = JDApiUtil.getGoodsDetail(id); // 鏅�氭帴鍙� + // jdGoods = JDApiUtil.getGoodsDetail(id); // 鏅�氭帴鍙� } - + if (jdGoods == null) { out.print(JsonUtil.loadFalseResult(2, "鍟嗗搧涓嶅瓨鍦�")); return; } - + List<String> imageList = jdGoods.getImageList(); if (imageList == null) { imageList = new ArrayList<String>(); imageList.add(jdGoods.getPicUrl()); } - + // 淇濆瓨缂撳瓨 jdGoodsCacheUtil.saveGoodsInfo(jdGoods); BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, null, fanLiRate, shareRate); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, fanLiRate, shareRate); + + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + if (couponInfo != null) { + // 鍒搁摼鎺ュ鐞� + String materialId = "https://item.jd.com/" + id + ".html"; + String url = JDApiUtil.convertLink(materialId, couponInfo.getLink(), JDApiUtil.POSITION_COUPON + "", + null); + couponInfo.setLink(url); + } ShopInfoVO shopInfo = goodsDetail.getShopInfo(); if (shopInfo != null) { @@ -594,8 +595,7 @@ goodsDetail.setShopInfo(null); } } - - + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); extraVO.setIsNative(false); // IOS鏄惁姝e湪涓婄嚎 @@ -639,8 +639,8 @@ } // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/"+ id +".html"); - + extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html"); + // 娴嬭瘯 SystemClientParams params = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, "goods_detail_jump_taobao"); @@ -649,8 +649,8 @@ } // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), jdGoods.getSkuId() + "", Constant.SOURCE_TYPE_JD); + String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -664,11 +664,7 @@ helpLink = configService.get("no_rebate_help_link"); } - // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + jdGoods.getSkuId(), - Constant.systemCommonConfig.getAppShareInfoUrl()); ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -717,7 +713,12 @@ BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, null, fanLiRate, shareRate); + GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, fanLiRate, shareRate); + CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); + if (couponInfo != null) { + String url = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null); + couponInfo.setLink(url); + } ShopInfoVO shopInfo = goodsDetail.getShopInfo(); if (shopInfo != null) { @@ -726,7 +727,7 @@ goodsDetail.setShopInfo(null); } } - + GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO(); extraVO.setIsNative(false); // IOS鏄惁姝e湪涓婄嚎 @@ -734,27 +735,37 @@ String version = acceptData.getVersion(); extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version))); } - - // 鍥炬枃璇︽儏 - extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id="+ id); - - Long inOrderCount30Days = pddGoods.getSoldQuantity(); - List<ShamUser> listShareUser = new ArrayList<ShamUser>(); - MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); - if (moneyInfo != null) { - String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); - if (Integer.parseInt(inOrderCount30Days.toString()) >= 50000) { - listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5); - } - } - extraVO.setListShareUser(listShareUser); - // 棰嗗埜浜哄垪琛� - List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); - if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 50000) { - listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); + // 鍥炬枃璇︽儏 + extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id); + + String salesTip = pddGoods.getSalesTip(); + if (!StringUtil.isNullOrEmpty(salesTip)) { + int totalSales = 0; + if (salesTip.contains("涓�")) { + salesTip = salesTip.substring(0, salesTip.indexOf("涓�")); + totalSales = (int) (Float.parseFloat(salesTip) * 10000); + } else { + totalSales = Integer.parseInt(salesTip); + } + + List<ShamUser> listShareUser = new ArrayList<ShamUser>(); + MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo(); + if (moneyInfo != null) { + String shareMoney = moneyInfo.getShareMoney().replaceAll("楼", ""); + if (totalSales >= 50000) { + listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5); + } + } + extraVO.setListShareUser(listShareUser); + + // 棰嗗埜浜哄垪琛� + List<ShamUser> listCouponUser = new ArrayList<ShamUser>(); + if (goodsDetail.isHasCoupon() && totalSales >= 50000) { + listCouponUser = shamUserService.listRandCouponUser(5, 1, 300); + } + extraVO.setListCouponUser(listCouponUser); } - extraVO.setListCouponUser(listCouponUser); if (uid != null) { // 鏄惁鍔犲叆鏀惰棌 @@ -772,9 +783,9 @@ extraVO.setIsNative(true); } - // 鍟嗗搧閾炬帴 - String h5Url = String.format("http://%s%s?id=%s&appType=flq&goodsType=%s", configService.getH5Host(), - Constant.systemCommonConfig.getShareGoodsPagePath(), id + "", Constant.SOURCE_TYPE_PDD); + // 鍒嗕韩璺緞 + String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(), + Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + ""); try { extraVO.setH5Url(HttpUtil.getShortLink(h5Url)); } catch (Exception e) { @@ -788,10 +799,8 @@ if (StringUtil.isNullOrEmpty(helpLink)) { helpLink = configService.get("no_rebate_help_link"); } - // 鍒嗕韩璺緞 - String shareUrl = String.format("%s?id=" + id, Constant.systemCommonConfig.getAppShareInfoUrl()); + ShareVO shareInfoVO = new ShareVO(); - shareInfoVO.setUrl(shareUrl); shareInfoVO.setHelpLink(helpLink); extraVO.setShare(shareInfoVO); @@ -811,10 +820,9 @@ } }); } - - + /** - * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛� + * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛� * * @param acceptData * @param id @@ -825,44 +833,44 @@ if (goodsType == null) { goodsType = Constant.SOURCE_TYPE_TAOBAO; } - + // 浜笢 if (goodsType == Constant.SOURCE_TYPE_JD) { JSONObject data = new JSONObject(); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + List<JDGoods> list = JDUtil.getRecommendGoodsById(id); if (list == null) { list = new ArrayList<JDGoods>(); } else if (list.size() > 10) { list = list.subList(0, 10); } - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - - for (JDGoods goods: list) { - listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, null, fanLiRate, shareRate)); + + for (JDGoods goods : list) { + listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate)); } - + // 鍙栧伓鏁颁釜鏁版嵁 if (listDetailVO.size() % 2 != 0) { listDetailVO.remove(listDetailVO.size() - 1); } - - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listDetailVO)); + + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); out.print(JsonUtil.loadTrueResult(data)); return; } - + // 鎷煎澶� if (goodsType == Constant.SOURCE_TYPE_PDD) { JSONObject data = new JSONObject(); - data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); - + data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>())); + List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>(); - + List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(id); if (goodsIdList != null && goodsIdList.size() > 0) { PDDSearchFilter pddfilter = new PDDSearchFilter(); @@ -870,42 +878,40 @@ pddfilter.setPageSize(Constant.PAGE_SIZE); Long[] strings = new Long[goodsIdList.size()]; pddfilter.setGoodsIdList(goodsIdList.toArray(strings)); - + PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter); if (result != null) { List<PDDGoodsDetail> goodsList = result.getGoodsList(); if (goodsList != null && goodsList.size() > 0) { - + if (goodsList.size() > 10) { goodsList = goodsList.subList(0, 10); } - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); for (PDDGoodsDetail goods : goodsList) { - listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, null, fanLiRate, shareRate)); + listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate)); } } } } - + // 鍙栧伓鏁颁釜鏁版嵁 if (listDetailVO.size() % 2 != 0) { listDetailVO.remove(listDetailVO.size() - 1); } - - data.put("listGuess", JsonUtil.getApiCommonGson().toJson(listDetailVO)); + + data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO)); out.print(JsonUtil.loadTrueResult(data)); return; } - List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.getRelationGoodsRecommend(id, 10); // 鍒濆鍖� if (goodsList == null) { goodsList = new ArrayList<TaoBaoGoodsBrief>(); } - List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>(); TaoKeAppInfo app = new TaoKeAppInfo(); @@ -927,10 +933,10 @@ } if (goodsList != null && goodsList.size() > 0) { - + BigDecimal fanLiRate = hongBaoManageService.getFanLiRate(); BigDecimal shareRate = hongBaoManageService.getShareRate(); - + goodsList.parallelStream().forEach(goods -> { if (goods != null) { // 鑾峰彇璇︽儏 @@ -955,8 +961,7 @@ } }); } - - + List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>(); // 鍙栧伓鏁颁釜鏁版嵁 if (listExtra.size() % 2 != 0) { @@ -973,10 +978,9 @@ out.print(JsonUtil.loadTrueResult(data)); } - - /** * 浜笢璐拱閾炬帴 + * * @param acceptData * @param uid * @param id @@ -995,7 +999,7 @@ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); return; } - + UserInfo user = userInfoService.getUserByIdWithMybatis(uid); if (user != null && user.getState() != UserInfo.STATE_NORMAL) { out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); @@ -1014,17 +1018,17 @@ if (couponInfo != null) { couponUrl = couponInfo.getLink(); } - String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", id + ""); - + String jumpLink = JDApiUtil.convertLink(materialId, couponUrl, JDApiUtil.POSITION_FANLI + "", uid + ""); + JSONObject data = new JSONObject(); data.put("native", true); data.put("jumpLink", jumpLink); out.print(JsonUtil.loadTrueResult(data)); } - /** * 鎷煎澶氳喘涔伴摼鎺� + * * @param acceptData * @param uid * @param id @@ -1043,7 +1047,7 @@ out.print(JsonUtil.loadFalseResult(1, "鍟嗗搧ID涓嶈兘涓虹┖")); return; } - + UserInfo user = userInfoService.getUserByIdWithMybatis(uid); if (user != null && user.getState() != UserInfo.STATE_NORMAL) { out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC)); @@ -1062,4 +1066,61 @@ data.put("jumpLink", jumpLink); out.print(JsonUtil.loadTrueResult(data)); } + + /** + * 鏄惁鍦ㄥ弬涓庢帹骞� + * + * @param goodsId + * -鍟嗗搧ID + * @param goodsType + * -TB/JD + * @param out + */ + @RequestMapping(value = "isGoodsExtend") + public void isGoodsExtend(AcceptData acceptData, String goodsId, Integer goodsType, PrintWriter out) { + if (StringUtil.isNullOrEmpty(goodsId)) { + out.print(JsonUtil.loadFalseResult(1, "鏈弬涓庢帹骞�")); + return; + } + if (goodsType == null) { + out.print(JsonUtil.loadFalseResult(2, "缂哄皯goodsType")); + return; + } + JSONObject data = new JSONObject(); + if (goodsType == Constant.SOURCE_TYPE_TAOBAO) { + TaoBaoGoodsBrief goods = null; + try { + goods = TaoKeApiUtil.getSimpleGoodsInfo(Long.parseLong(goodsId)); + } catch (NumberFormatException e) { + e.printStackTrace(); + } catch (TaobaoGoodsDownException e) { + e.printStackTrace(); + } + + if (goods == null) { + data.put("extend", false); + data.put("url", "https://h5.m.taobao.com/awp/core/detail.htm?id=" + goodsId); + } else { + data.put("extend", true); + } + + } else if (goodsType == Constant.SOURCE_TYPE_JD) { + JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(goodsId)); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://item.m.jd.com/product/%s.html", goodsId)); + } else { + data.put("extend", true); + } + } else if (goodsType == Constant.SOURCE_TYPE_PDD) { + PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId)); + if (goods == null) { + data.put("extend", false); + data.put("url", String.format("https://mobile.yangkeduo.com/goods.html?goods_id=%s", goodsId)); + } else { + data.put("extend", true); + } + } + out.print(JsonUtil.loadTrueResult(data)); + } } -- Gitblit v1.8.0