| | |
| | | package com.yeshi.fanli.controller.client.v2; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsJumpLinkVO; |
| | | import com.yeshi.fanli.vo.suning.SuningConvertLinkResult; |
| | | import org.json.simple.JSONArray; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | import com.yeshi.fanli.dto.jd.JDCouponInfo; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult; |
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl; |
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfo; |
| | | import com.yeshi.fanli.dto.suning.SuningGoodsInfoRecommend; |
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.GoodsEvaluateService; |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service; |
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service; |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; |
| | | import com.yeshi.fanli.service.inter.jd.JDGoodsClassService; |
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService; |
| | | import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService; |
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService; |
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; |
| | | import com.yeshi.goods.facade.service.DaTaoKeGoodsDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService; |
| | | import com.yeshi.fanli.service.inter.user.ShamUserService; |
| | | import com.yeshi.fanli.service.inter.user.TBPidService; |
| | | import com.yeshi.fanli.service.inter.user.UserGoodsStorageService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService; |
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; |
| | |
| | | return; |
| | | } |
| | | |
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | PDDGoodsDetail pddGoods = null; |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid)); |
| | | } catch (PDDApiException e) { |
| | | e.printStackTrace(); |
| | | if (e.getCode() == PDDApiException.CODE_NOT_AUTH) { |
| | | try { |
| | | pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id, PinDuoDuoApiUtil.PID_FANLI, Constant.PDD_SEARCH_CUSTOMER_PARAMS); |
| | | } catch (PDDApiException e1) { |
| | | } |
| | | } |
| | | } |
| | | if (pddGoods == null) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品不存在")); |
| | | return; |
| | |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDPromotionUrl convertUrl = null; |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | if (convertUrl != null) |
| | | couponInfo.setLink(convertUrl.getUrl()); |
| | | } |
| | |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | final PDDGoodsDetail fGoods = pddGoods; |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | | try { |
| | | scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods); |
| | | scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), fGoods); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | try { |
| | | goodsEvaluateService.updatePDDGoods(pddGoods); |
| | | goodsEvaluateService.updatePDDGoods(fGoods); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(jumpLink); |
| | | vo.setNativeJumpLink(jumpLink); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", jumpLink); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(jumpLink); |
| | | vo.setNativeJumpLink(jumpLink); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jumpLink, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | return; |
| | | } |
| | | |
| | | //TODO 是否需要返回绑定链接 |
| | | String customParams = pddAuthService.getFanliCustomParams(uid); |
| | | boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(id, pid + "", customParams, !auth); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", convertUrl.getUrl()); |
| | | data.put("nativeJumpLink", PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); |
| | | LogHelper.test(String.format("拼多多转链:uid:%s data:%s", uid + "", data.toString())); |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (!auth) { |
| | | convertUrl = PinDuoDuoApiUtil.getAuthLink(pid, customParams); |
| | | } else { |
| | | convertUrl = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), pid + "", customParams, !auth); |
| | | LogHelper.test(String.format("拼多多转链:uid:%s data:%s", uid + "", data.toString())); |
| | | } |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl())); |
| | | vo.setJumpLink(convertUrl.getUrl()); |
| | | if (convertUrl.getWe_app_info() != null) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setPath(convertUrl.getWe_app_info().getPage_path()); |
| | | wxxcxJumpInfoVO.setUserName(convertUrl.getWe_app_info().getUser_name()); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | // 获得金币 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 拼多多购买链接 |
| | | * 唯品会购买链接 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | |
| | | } |
| | | |
| | | VIPConvertResultDTO convertUrl = VipShopApiUtil.convertLink(id + "", tag); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", true); |
| | | data.put("jumpLink", convertUrl.getUrl()); |
| | | data.put("nativeJumpLink", convertUrl.getDeeplinkUrl()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(convertUrl.getUrl()); |
| | | vo.setNativeJumpLink(convertUrl.getDeeplinkUrl()); |
| | | if (!StringUtil.isNullOrEmpty(convertUrl.getVipWxUrl())) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_8ed2afad9972"); |
| | | wxxcxJumpInfoVO.setPath(convertUrl.getVipWxUrl()); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | | } |
| | |
| | | String quanUrl = null; |
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo().getCouponUrl())) |
| | | quanUrl = goods.getCouponInfo().getCouponUrl(); |
| | | String link = SuningApiUtil.convertLink(SuningUtil.getProductUrl(supplierCode, goodsCode), quanUrl, |
| | | SuningConvertLinkResult link = SuningApiUtil.convertLinkNew(goodsCode, supplierCode, |
| | | pid, uid + ""); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("native", false); |
| | | data.put("jumpLink", link); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(false); |
| | | try { |
| | | vo.setJumpLink(URLDecoder.decode(link.getWapExtendUrl(), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (!StringUtil.isNullOrEmpty(link.getSpPageUrl())) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_1d1e15e90afc"); |
| | | try { |
| | | wxxcxJumpInfoVO.setPath(URLDecoder.decode(link.getSpPageUrl(), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | | |
| | | // 获得金币 |
| | | integralGetService.addCouponRebate(uid); |
| | |
| | | |
| | | link = JDApiUtil.convertLinkWithSubUnionId(link, null, null, JDApiUtil.POSITION_FANLI + "", uid + ""); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("link", link); |
| | | |
| | | GoodsJumpLinkVO vo = new GoodsJumpLinkVO(); |
| | | vo.set_native(true); |
| | | vo.setJumpLink(link); |
| | | vo.setNativeJumpLink(link); |
| | | try { |
| | | String wxPage = "pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(link, "UTF-8"); |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName("gh_45b306365c3d"); |
| | | wxxcxJumpInfoVO.setPath(wxPage); |
| | | vo.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |