| | |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.GsonUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import org.apache.commons.beanutils.PropertyUtils; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | } |
| | | // 不是用ID的登陆的事就多了 |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(),acceptData.getSystem()); |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | |
| | | } |
| | | // 不是用ID的登陆的事就多了 |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(),acceptData.getSystem()); |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | |
| | | int versionCode = Integer.parseInt(version); |
| | | String platform = acceptData.getPlatform(); |
| | | |
| | | AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0",acceptData.getSystem()); |
| | | AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0", acceptData.getSystem()); |
| | | if (versionInfo != null) { |
| | | int versionCode150 = versionInfo.getVersionCode(); |
| | | if (versionCode >= versionCode150) { |
| | |
| | | |
| | | int showTiCheng = 1; // 不显示 |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) |
| | | data.put("showTiCheng", false); |
| | | else { |
| | | data.put("showTiCheng", spreadImgCount + shareCount > 0); |
| | |
| | | } |
| | | |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) |
| | | data.put("inviteList", String.format("http://%s/%s/client/share/friends_new_online.html", |
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName())); |
| | | else |
| | | data.put("inviteList", configService.getValue(ConfigKeyEnum.teamList.getKey(),acceptData.getSystem())); |
| | | data.put("inviteList", configService.getValue(ConfigKeyEnum.teamList.getKey(), acceptData.getSystem())); |
| | | |
| | | // 界面状态 |
| | | UserSettingsVO mySettings = null; |
| | |
| | | |
| | | data.put("error", "0"); |
| | | data.put("maxError", 1); |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY,acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxMoney = configService.getValue(EXTRACT_MAX_MONEY,acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxDayMoney = configService.getValue(ConfigKeyEnum.extractMoneyDay.getKey(),acceptData.getSystem()); // 每日最大提现金额 |
| | | int maxDayCount = Integer.parseInt(configService.getValue(ConfigKeyEnum.extractDayCount.getKey(),acceptData.getSystem())); |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY, acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxMoney = configService.getValue(EXTRACT_MAX_MONEY, acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxDayMoney = configService.getValue(ConfigKeyEnum.extractMoneyDay.getKey(), acceptData.getSystem()); // 每日最大提现金额 |
| | | int maxDayCount = Integer.parseInt(configService.getValue(ConfigKeyEnum.extractDayCount.getKey(), acceptData.getSystem())); |
| | | ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid); |
| | | boolean canExtract = true; |
| | | String errorMsg = ""; |
| | |
| | | return; |
| | | } |
| | | |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY,acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxDayMoney = configService.getValue(ConfigKeyEnum.extractMoneyDay.getKey(),acceptData.getSystem()); // 每日最大提现金额 |
| | | int maxDayCount = Integer.parseInt(configService.getValue(ConfigKeyEnum.extractDayCount.getKey(),acceptData.getSystem())); |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY, acceptData.getSystem()); // 单笔提现的最小金额 |
| | | String maxDayMoney = configService.getValue(ConfigKeyEnum.extractMoneyDay.getKey(), acceptData.getSystem()); // 每日最大提现金额 |
| | | int maxDayCount = Integer.parseInt(configService.getValue(ConfigKeyEnum.extractDayCount.getKey(), acceptData.getSystem())); |
| | | ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid); |
| | | boolean canExtract = true; |
| | | String errorMsg = ""; |
| | |
| | | } |
| | | |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(),acceptData.getSystem()); |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | LogHelper.userInfo("提现时,不存在该系统"); |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | | } |
| | | |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY,acceptData.getSystem()); // 单笔提现最小金额 |
| | | String minMoney = configService.getValue(EXTRACT_MIN_MONEY, acceptData.getSystem()); // 单笔提现最小金额 |
| | | |
| | | if (money.compareTo(new BigDecimal("0.1")) < 0) { // 转帐到支付宝的最小金额 |
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额需要大于:" + 0.1 + "元")); |
| | |
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额需要大于:" + minMoney + "元")); |
| | | return; |
| | | } |
| | | String maxMoney = configService.getValue(EXTRACT_MAX_MONEY,acceptData.getSystem()); // 单笔提现最大金额 |
| | | String maxMoney = configService.getValue(EXTRACT_MAX_MONEY, acceptData.getSystem()); // 单笔提现最大金额 |
| | | if (new BigDecimal(maxMoney).compareTo(money) < 0) { // 后台设置的单笔转账的最大金额 |
| | | out.print(JsonUtil.loadFalseResult("单笔提现金额多为:" + maxMoney + "元")); |
| | | return; |
| | |
| | | } |
| | | |
| | | long[] targetUids = new long[]{3L, 4L, 5L}; |
| | | Config config = configService.getConfig(ConfigKeyEnum.extractCodeEmailFrom.getKey(),acceptData.getSystem()); |
| | | Config config = configService.getConfig(ConfigKeyEnum.extractCodeEmailFrom.getKey(), acceptData.getSystem()); |
| | | String[] sts = config.getValue().split(","); |
| | | String account = sts[0]; |
| | | String pwd = sts[1]; |
| | |
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime)); |
| | | } |
| | | |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem()); |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(), acceptData.getSystem()); |
| | | if (helpLink == null) { |
| | | helpLink = ""; |
| | | } |
| | |
| | | hasCode = true; // 已有邀请码 |
| | | } else { |
| | | // 邀请激活链接 |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem())); |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(), acceptData.getSystem())); |
| | | } |
| | | resultData.put("hasCode", hasCode); |
| | | |
| | |
| | | bossData.put("inviteTime", "邀请时间: " + sdf.format(inviteTime)); |
| | | } |
| | | |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem()); |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(), acceptData.getSystem()); |
| | | if (helpLink == null) { |
| | | helpLink = ""; |
| | | } |
| | |
| | | hasCode = true; // 已有邀请码 |
| | | } else { |
| | | // 邀请激活链接 |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem())); |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(), acceptData.getSystem())); |
| | | } |
| | | resultData.put("hasCode", hasCode); |
| | | |
| | |
| | | |
| | | JSONObject resultData = new JSONObject(); |
| | | |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(),acceptData.getSystem()); |
| | | String helpLink = configService.getValue(ConfigKeyEnum.teamHelpUrl.getKey(), acceptData.getSystem()); |
| | | if (helpLink == null) { |
| | | helpLink = ""; |
| | | } |
| | |
| | | hasCode = true; // 已有邀请码 |
| | | } else { |
| | | // 邀请激活链接 |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem())); |
| | | resultData.put("activationlink", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(), acceptData.getSystem())); |
| | | } |
| | | resultData.put("hasCode", hasCode); |
| | | |
| | |
| | | if (inviteCode == null || inviteCode.trim().length() == 0) { |
| | | // 无邀请码 |
| | | inviteData.put("content", "邀请激活"); |
| | | inviteData.put("link", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(),acceptData.getSystem())); |
| | | inviteData.put("link", configService.getValue(ConfigKeyEnum.inviteActivationUrl.getKey(), acceptData.getSystem())); |
| | | } else { |
| | | // 已有邀请码 |
| | | inviteData.put("content", "邀请码"); |
| | | inviteData.put("link", configService.getValue(ConfigKeyEnum.inviteActivationSuccessUrl.getKey(),acceptData.getSystem())); |
| | | inviteData.put("link", configService.getValue(ConfigKeyEnum.inviteActivationSuccessUrl.getKey(), acceptData.getSystem())); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | |
| | | public void getuserinfoNew(AcceptData acceptData, Long uid, HttpServletRequest requst, PrintWriter out) { |
| | | try { |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(),acceptData.getSystem()); |
| | | acceptData.getPackages(), acceptData.getSystem()); |
| | | if (system == null) { |
| | | out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | return; |
| | |
| | | data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息 |
| | | data.put("vipLink", userVipConfigService.getValueByKey("vip_link"));// 超级会员升级链接 |
| | | |
| | | if(SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.bindPhone)) { |
| | | if (SystemInfoUtil.hasFunctions(acceptData.getSystem(), SystemFunction.bindPhone)) { |
| | | // 2.0.1之后绑定手机号 |
| | | if (VersionUtil.greaterThan_2_0_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | boolean bindPhone = false; |
| | |
| | | } |
| | | |
| | | if (VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | data.put("fansCountLink", configService.getValue(ConfigKeyEnum.teamStatisticsLink.getKey(),acceptData.getSystem())); |
| | | data.put("fansCountLink", configService.getValue(ConfigKeyEnum.teamStatisticsLink.getKey(), acceptData.getSystem())); |
| | | // 会员动作 |
| | | // 查询是否为超级会员,是的话返回超会管理链接 |
| | | UserLevelEnum level = userLevelManager.getUserLevel(uid); |
| | |
| | | } |
| | | |
| | | data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo)); |
| | | //拼多多是否绑定 |
| | | if (VersionUtil.greaterThan_2_1_5(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | boolean pddBuyBind = PinDuoDuoApiUtil.isAuth(PinDuoDuoApiUtil.PID_FANLI, PinDuoDuoUtil.getCustomParams(uid)); |
| | | boolean pddShareBind = PinDuoDuoApiUtil.isAuth(PinDuoDuoApiUtil.PID_SHARE, PinDuoDuoUtil.getCustomParams(uid)); |
| | | data.put("pddBuyBind", pddBuyBind); |
| | | data.put("pddShareBind", pddShareBind); |
| | | } |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | |
| | |
| | | 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.pdd.PDDJumpLinkVO; |
| | | import org.json.simple.JSONArray; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDPromotionUrl convertUrl = null; |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null, false); |
| | | if (convertUrl != null) |
| | |
| | | object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail)); |
| | | out.print(JsonUtil.loadTrueResult(object.toString())); |
| | | |
| | | final PDDGoodsDetail fGoods=pddGoods; |
| | | final PDDGoodsDetail fGoods = pddGoods; |
| | | ThreadUtil.run(new Runnable() { |
| | | public void run() { |
| | | // 添加浏览记录 |
| | |
| | | return; |
| | | } |
| | | |
| | | //TODO 是否需要返回绑定链接 |
| | | String customParams = pddAuthService.getFanliCustomParams(uid); |
| | | boolean auth = PinDuoDuoApiUtil.isAuth(pid, customParams); |
| | | PDDPromotionUrl convertUrl = PinDuoDuoApiUtil.convert(goods.getGoodsSign(), 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())); |
| | | } |
| | | |
| | | PDDJumpLinkVO vo = new PDDJumpLinkVO(); |
| | | 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)); |
| | | |
| | | // 获得金币 |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import com.yeshi.fanli.vo.pdd.PDDJumpLinkVO; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | |
| | | |
| | | /** |
| | | * 热销榜 |
| | | * |
| | | * @author Administrator |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v2/pdd") |
| | | public class PinDuoDuoControllerV2 { |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | @Resource |
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService; |
| | | @Resource |
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService; |
| | | |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | | @Resource |
| | | private JumpDetailV2Service jumpDetailV2Service; |
| | | |
| | | @Resource |
| | | private DaTaoKeGoodsService daTaoKeGoodsService; |
| | | |
| | | @Resource |
| | | private SwiperPictureService swiperPictureService; |
| | | |
| | | @Resource |
| | | private QualityGoodsService qualityGoodsService; |
| | | |
| | | @Resource |
| | | private SpecialService specialService; |
| | | @Resource |
| | | private DaTaoKeGoodsService daTaoKeGoodsService; |
| | | |
| | | @Resource |
| | | private PDDGoodsService pddGoodsService; |
| | | |
| | | @Resource |
| | | private SwiperPictureService swiperPictureService; |
| | | |
| | | |
| | | /** |
| | | * 拼多多专题分类 |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getClass") |
| | | public void getJDClass(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject root = new JSONObject(); |
| | | root.put("list", pddGoodsService.getSpecialClass()); |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼多多专题 |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getGoodsInfo") |
| | | public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) { |
| | | JSONObject root = new JSONObject(); |
| | | if (cid == 1 && page == 1) { |
| | | List<BannerVO> topPicList = swiperPictureService.getByBannerCardAndVersion("pinduoduo_special_index",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | if (topPicList == null) { |
| | | topPicList = new ArrayList<BannerVO>(); |
| | | } |
| | | root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList)); |
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); |
| | | List<Special> listSpecial = specialService.listByPlaceKey("pinduoduo_special_index", platformCode, Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); |
| | | if (listSpecial == null) { |
| | | listSpecial = new ArrayList<Special>(); |
| | | } |
| | | root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial)); |
| | | } |
| | | |
| | | try { |
| | | List<PDDGoodsDetail> goodsList = pddGoodsService.specialSearch(page, cid); |
| | | JSONArray array = new JSONArray(); |
| | | if (goodsList != null && goodsList.size() > 0) { |
| | | Gson gson = JsonUtil.getApiCommonGson(); |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(),acceptData.getSystem()); |
| | | @Resource |
| | | private QualityGoodsService qualityGoodsService; |
| | | |
| | | for (PDDGoodsDetail goods : goodsList) { |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO); |
| | | array.add(gson.toJson(goodsDetailVO)); |
| | | } |
| | | } |
| | | root.put("list", array); |
| | | root.put("count", 1000); |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (PDDOrderException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private SpecialService specialService; |
| | | |
| | | @Resource |
| | | private PDDGoodsService pddGoodsService; |
| | | |
| | | |
| | | /** |
| | | * 拼多多专题分类 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getClass") |
| | | public void getClass(AcceptData acceptData, PrintWriter out) { |
| | | JSONObject root = new JSONObject(); |
| | | root.put("list", pddGoodsService.getSpecialClass()); |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼多多专题 |
| | | * |
| | | * @param acceptData |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getGoodsInfo") |
| | | public void getGoodsInfo(AcceptData acceptData, Long cid, Integer page, PrintWriter out) { |
| | | JSONObject root = new JSONObject(); |
| | | if (cid == 1 && page == 1) { |
| | | List<BannerVO> topPicList = swiperPictureService.getByBannerCardAndVersion("pinduoduo_special_index", acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | if (topPicList == null) { |
| | | topPicList = new ArrayList<BannerVO>(); |
| | | } |
| | | root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList)); |
| | | int platformCode = Constant.getPlatformCode(acceptData.getPlatform()); |
| | | List<Special> listSpecial = specialService.listByPlaceKey("pinduoduo_special_index", platformCode, Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | if (listSpecial == null) { |
| | | listSpecial = new ArrayList<Special>(); |
| | | } |
| | | root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial)); |
| | | } |
| | | |
| | | try { |
| | | List<PDDGoodsDetail> goodsList = pddGoodsService.specialSearch(page, cid); |
| | | JSONArray array = new JSONArray(); |
| | | if (goodsList != null && goodsList.size() > 0) { |
| | | Gson gson = JsonUtil.getApiCommonGson(); |
| | | ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | for (PDDGoodsDetail goods : goodsList) { |
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO); |
| | | array.add(gson.toJson(goodsDetailVO)); |
| | | } |
| | | } |
| | | root.put("list", array); |
| | | root.put("count", 1000); |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (PDDOrderException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "getAuthJumpInfo") |
| | | public void getAuthJumpInfo(AcceptData acceptData, Long uid, int type, PrintWriter out) { |
| | | if (uid == null || uid == 0L) { |
| | | out.print(JsonUtil.loadFalseResult("请先登录")); |
| | | return; |
| | | } |
| | | String pid = null; |
| | | //自购 |
| | | if (type == 1) { |
| | | pid = PinDuoDuoApiUtil.PID_FANLI; |
| | | } else {//分享 |
| | | pid = PinDuoDuoApiUtil.PID_SHARE; |
| | | } |
| | | |
| | | PDDConvertLinkResultVO authLink = PinDuoDuoApiUtil.getAuthLink(pid, PinDuoDuoUtil.getCustomParams(uid)); |
| | | |
| | | PDDJumpLinkVO pddJumpLinkVO = new PDDJumpLinkVO(); |
| | | |
| | | pddJumpLinkVO.set_native(true); |
| | | pddJumpLinkVO.setJumpLink(authLink.getMobile_url()); |
| | | pddJumpLinkVO.setNativeJumpLink(PinDuoDuoUtil.getAndroidNativeURI(authLink.getMobile_url())); |
| | | if (authLink.getWe_app_info() != null) { |
| | | WXXCXJumpInfoVO wxxcxJumpInfoVO = new WXXCXJumpInfoVO(); |
| | | wxxcxJumpInfoVO.setUserName(authLink.getWe_app_info().getUser_name()); |
| | | wxxcxJumpInfoVO.setPath(authLink.getWe_app_info().getPage_path()); |
| | | pddJumpLinkVO.setWxxcxJumpInfo(wxxcxJumpInfoVO); |
| | | } |
| | | |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(pddJumpLinkVO)); |
| | | data.put("native", pddJumpLinkVO.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | public void createPDDShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods, |
| | | PrintWriter out) { |
| | | |
| | | //查询当前用户是否授权 |
| | | |
| | | if (VersionUtil.greaterThan_2_1_5(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | if (!PinDuoDuoApiUtil.isAuth(PinDuoDuoApiUtil.PID_SHARE, PinDuoDuoUtil.getCustomParams(uid))) { |
| | | JsonUtil.loadFalseResult(20001, "尚未备案,请先备案"); |
| | | } |
| | | } |
| | | |
| | | |
| | | PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架")); |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.json.simple.JSONArray; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | goodsDetail.setOtherInfo(otherInfo); |
| | | |
| | | CouponInfoVO couponInfo = goodsDetail.getCouponInfo(); |
| | | PDDPromotionUrl convertUrl = null; |
| | | PDDConvertLinkResultVO convertUrl = null; |
| | | if (couponInfo != null) { |
| | | convertUrl = PinDuoDuoApiUtil.convert(pddGoods.getGoodsSign(), PinDuoDuoApiUtil.PID_COUPON + "", null,false); |
| | | if (convertUrl != null) |
| | |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Override |
| | | public String createPDDAuthLink(Long uid, String pid) throws Exception { |
| | | String customParams = PinDuoDuoUtil.getCustomParams(uid); |
| | | String link = PinDuoDuoApiUtil.getAuthLink(pid, customParams); |
| | | if (StringUtil.isNullOrEmpty(link)) { |
| | | PDDConvertLinkResultVO link = PinDuoDuoApiUtil.getAuthLink(pid, customParams); |
| | | if (link == null) { |
| | | throw new Exception("生成授权链接失败"); |
| | | } |
| | | UserPDDAuthRecord record = new UserPDDAuthRecord(); |
| | |
| | | if (userPDDAuthRecordDao.get(record.getId()) == null) { |
| | | userPDDAuthRecordDao.save(record); |
| | | } |
| | | return link; |
| | | return link.getMobile_url(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | |
| | | PDDGoodsDetail goodsDetail = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(goodsId)); |
| | | if (goodsDetail == null) |
| | | throw new Exception("拼多多转链失败"); |
| | | PDDPromotionUrl pddUrl = PinDuoDuoApiUtil.convert(goodsDetail.getGoodsSign(), |
| | | PDDConvertLinkResultVO pddUrl = PinDuoDuoApiUtil.convert(goodsDetail.getGoodsSign(), |
| | | share ? PinDuoDuoApiUtil.PID_SHARE : PinDuoDuoApiUtil.PID_FANLI, pddAuthService.getFanliCustomParams(uid), false); |
| | | if (pddUrl != null) { |
| | | linkMap.put(shortLink, pddUrl.getShortUrl()); |
| | | linkMap.put(shortLink, pddUrl.getShort_url()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public class UserInviteUtil { |
| | | |
| | | /** |
| | | * 获取分享链接 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public static String getShareUrl(Long uid) { |
| | | String erCode = ("http://" + Constant.wxGZConfig.getLoginHost() + "/" |
| | | + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid); |
| | | return erCode; |
| | | } |
| | | /** |
| | | * 获取分享链接 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public static String getShareUrl(Long uid) { |
| | | String erCode = Constant.YINGYONGBAO_LINK; |
| | | // ("http://" + Constant.wxGZConfig.getLoginHost() + "/" |
| | | // + Constant.systemCommonConfig.getProjectName() + "/client/threeShareNew?uid=" + uid); |
| | | |
| | | return erCode; |
| | | } |
| | | |
| | | } |
| | |
| | | else |
| | | return false; |
| | | } |
| | | |
| | | public static boolean greaterThan_2_1_5(String platform, String versionCode) { |
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 62)) |
| | | || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 84))) |
| | | return true; |
| | | else |
| | | return false; |
| | | } |
| | | |
| | | public static boolean smallerThan_1_5_1(String platform, String versionCode) { |
| | | if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 36)) |
| | |
| | | import java.util.*; |
| | | |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.vo.pdd.PDDConvertLinkResultVO; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | * @param customParams |
| | | * @return |
| | | */ |
| | | public static PDDPromotionUrl convert(String goodsSign, String pid, String customParams, boolean withAuthLink) { |
| | | public static PDDConvertLinkResultVO convert(String goodsSign, String pid, String customParams, boolean withAuthLink) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.goods.promotion.url.generate"); |
| | | map.put("p_id", pid); |
| | |
| | | } |
| | | JSONArray resultArray = json.optJSONArray("goods_promotion_url_list"); |
| | | if (resultArray != null && resultArray.size() > 0) { |
| | | Type type = new TypeToken<PDDPromotionUrl>() { |
| | | Type type = new TypeToken<PDDConvertLinkResultVO>() { |
| | | }.getType(); |
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create(); |
| | | return gson.fromJson(resultArray.optJSONObject(0).toString(), type); |
| | |
| | | * @return |
| | | */ |
| | | public static String getPromotionUrl(String goodsSign, String pid, String customParams) { |
| | | PDDPromotionUrl promotion = convert(goodsSign, pid, customParams, false); |
| | | PDDConvertLinkResultVO promotion = convert(goodsSign, pid, customParams, false); |
| | | if (promotion != null) { |
| | | return promotion.getShortUrl(); |
| | | return promotion.getShort_url(); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static String getAuthLink(String pid, String customParameters) { |
| | | /** |
| | | * 生成授权链接 |
| | | * |
| | | * @param pid |
| | | * @param customParameters |
| | | * @return |
| | | */ |
| | | public static PDDConvertLinkResultVO getAuthLink(String pid, String customParameters) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.rp.prom.url.generate"); |
| | | map.put("channel_type", 10 + ""); |
| | | map.put("generate_we_app", true + ""); |
| | | map.put("custom_parameters", customParameters); |
| | | map.put("p_id_list", "[\"" + pid + "\"]"); |
| | | String result = baseRequest(map); |
| | | System.out.println(result); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | | JSONArray array = resultJson.optJSONObject("rp_promotion_url_generate_response").optJSONArray("url_list"); |
| | | if (array != null && array.size() > 0) { |
| | | JSONObject item = array.optJSONObject(0); |
| | | String url = item.optString("url"); |
| | | if (StringUtil.isNullOrEmpty(url)) { |
| | | url = item.optString("mobile_url"); |
| | | } |
| | | return url; |
| | | Type type = new TypeToken<List<PDDConvertLinkResultVO>>() { |
| | | }.getType(); |
| | | List<PDDConvertLinkResultVO> list = new Gson().fromJson(array.toString(), type); |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | // PDDConvertLinkResultVO vo = getAuthLink(PID_SHARE, PinDuoDuoUtil.getCustomParams(437032l)); |
| | | // |
| | | // System.out.println(vo); |
| | | PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(227873724698L); |
| | | |
| | | |
| | | PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_FANLI + "","437032", false); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.common; |
| | | |
| | | public class WXXCXJumpInfoVO { |
| | | private String userName; |
| | | private String path; |
| | | |
| | | public String getUserName() { |
| | | return userName; |
| | | } |
| | | |
| | | public void setUserName(String userName) { |
| | | this.userName = userName; |
| | | } |
| | | |
| | | public String getPath() { |
| | | return path; |
| | | } |
| | | |
| | | public void setPath(String path) { |
| | | this.path = path; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.jd; |
| | | |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | |
| | | /** |
| | | * 拼多多跳转链接 |
| | | */ |
| | | public class JDJumpLinkVO { |
| | | private String jumpLink; |
| | | private boolean _native; |
| | | private WXXCXJumpInfoVO wxxcxJumpInfo; |
| | | |
| | | public String getJumpLink() { |
| | | return jumpLink; |
| | | } |
| | | |
| | | public void setJumpLink(String jumpLink) { |
| | | this.jumpLink = jumpLink; |
| | | } |
| | | |
| | | |
| | | public boolean is_native() { |
| | | return _native; |
| | | } |
| | | |
| | | public void set_native(boolean _native) { |
| | | this._native = _native; |
| | | } |
| | | |
| | | public WXXCXJumpInfoVO getWxxcxJumpInfo() { |
| | | return wxxcxJumpInfo; |
| | | } |
| | | |
| | | public void setWxxcxJumpInfo(WXXCXJumpInfoVO wxxcxJumpInfo) { |
| | | this.wxxcxJumpInfo = wxxcxJumpInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.pdd; |
| | | |
| | | public class PDDConvertLinkResultVO { |
| | | |
| | | |
| | | private String mobile_url; |
| | | private WeAppInfoBean we_app_info; |
| | | private String url; |
| | | private String mobile_short_url; |
| | | private String short_url; |
| | | |
| | | |
| | | public String getMobile_short_url() { |
| | | return mobile_short_url; |
| | | } |
| | | |
| | | public void setMobile_short_url(String mobile_short_url) { |
| | | this.mobile_short_url = mobile_short_url; |
| | | } |
| | | |
| | | public String getShort_url() { |
| | | return short_url; |
| | | } |
| | | |
| | | public void setShort_url(String short_url) { |
| | | this.short_url = short_url; |
| | | } |
| | | |
| | | public String getMobile_url() { |
| | | return mobile_url; |
| | | } |
| | | |
| | | public void setMobile_url(String mobile_url) { |
| | | this.mobile_url = mobile_url; |
| | | } |
| | | |
| | | public WeAppInfoBean getWe_app_info() { |
| | | return we_app_info; |
| | | } |
| | | |
| | | public void setWe_app_info(WeAppInfoBean we_app_info) { |
| | | this.we_app_info = we_app_info; |
| | | } |
| | | |
| | | public String getUrl() { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) { |
| | | this.url = url; |
| | | } |
| | | |
| | | public static class WeAppInfoBean { |
| | | /** |
| | | * we_app_icon_url : http://xcxcdn.yangkeduo.com/pdd_logo.png |
| | | * user_name : gh_a6611aee87d6 |
| | | * page_path : /pages/web/web?specialUrl=1&src=https%3A%2F%2Fmobile.yangkeduo.com%2Fduo_coupon_landing.html%3F__page%3Dauth%26pid%3D8590899_72067895%26customParameters%3D437032_20210428%26cpsSign%3DCC_210428_8590899_72067895_4c6d8bf9fbfde82ac15214b7e0ae93f8%26duoduo_type%3D2 |
| | | * source_display_name : 拼多多福利券 |
| | | * title : 认证页 |
| | | * app_id : wxa918198f16869201 |
| | | * desc : 拼多多,多实惠,多乐趣。 |
| | | */ |
| | | |
| | | private String we_app_icon_url; |
| | | private String user_name; |
| | | private String page_path; |
| | | private String source_display_name; |
| | | private String title; |
| | | private String app_id; |
| | | private String desc; |
| | | |
| | | public String getWe_app_icon_url() { |
| | | return we_app_icon_url; |
| | | } |
| | | |
| | | public void setWe_app_icon_url(String we_app_icon_url) { |
| | | this.we_app_icon_url = we_app_icon_url; |
| | | } |
| | | |
| | | public String getUser_name() { |
| | | return user_name; |
| | | } |
| | | |
| | | public void setUser_name(String user_name) { |
| | | this.user_name = user_name; |
| | | } |
| | | |
| | | public String getPage_path() { |
| | | return page_path; |
| | | } |
| | | |
| | | public void setPage_path(String page_path) { |
| | | this.page_path = page_path; |
| | | } |
| | | |
| | | public String getSource_display_name() { |
| | | return source_display_name; |
| | | } |
| | | |
| | | public void setSource_display_name(String source_display_name) { |
| | | this.source_display_name = source_display_name; |
| | | } |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getApp_id() { |
| | | return app_id; |
| | | } |
| | | |
| | | public void setApp_id(String app_id) { |
| | | this.app_id = app_id; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.pdd; |
| | | |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | |
| | | /** |
| | | * 拼多多跳转链接 |
| | | */ |
| | | public class PDDJumpLinkVO { |
| | | private String jumpLink; |
| | | private boolean _native; |
| | | private String nativeJumpLink; |
| | | private WXXCXJumpInfoVO wxxcxJumpInfo; |
| | | |
| | | public String getJumpLink() { |
| | | return jumpLink; |
| | | } |
| | | |
| | | public void setJumpLink(String jumpLink) { |
| | | this.jumpLink = jumpLink; |
| | | } |
| | | |
| | | |
| | | public boolean is_native() { |
| | | return _native; |
| | | } |
| | | |
| | | public void set_native(boolean _native) { |
| | | this._native = _native; |
| | | } |
| | | |
| | | public String getNativeJumpLink() { |
| | | return nativeJumpLink; |
| | | } |
| | | |
| | | public void setNativeJumpLink(String nativeJumpLink) { |
| | | this.nativeJumpLink = nativeJumpLink; |
| | | } |
| | | |
| | | public WXXCXJumpInfoVO getWxxcxJumpInfo() { |
| | | return wxxcxJumpInfo; |
| | | } |
| | | |
| | | public void setWxxcxJumpInfo(WXXCXJumpInfoVO wxxcxJumpInfo) { |
| | | this.wxxcxJumpInfo = wxxcxJumpInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.suning; |
| | | |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | |
| | | /** |
| | | * 拼多多跳转链接 |
| | | */ |
| | | public class SuningJumpLinkVO { |
| | | private String jumpLink; |
| | | private boolean _native; |
| | | private WXXCXJumpInfoVO wxxcxJumpInfo; |
| | | |
| | | public String getJumpLink() { |
| | | return jumpLink; |
| | | } |
| | | |
| | | public void setJumpLink(String jumpLink) { |
| | | this.jumpLink = jumpLink; |
| | | } |
| | | |
| | | |
| | | public boolean is_native() { |
| | | return _native; |
| | | } |
| | | |
| | | public void set_native(boolean _native) { |
| | | this._native = _native; |
| | | } |
| | | |
| | | public WXXCXJumpInfoVO getWxxcxJumpInfo() { |
| | | return wxxcxJumpInfo; |
| | | } |
| | | |
| | | public void setWxxcxJumpInfo(WXXCXJumpInfoVO wxxcxJumpInfo) { |
| | | this.wxxcxJumpInfo = wxxcxJumpInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.vo.vipshop; |
| | | |
| | | import com.yeshi.fanli.vo.common.WXXCXJumpInfoVO; |
| | | |
| | | /** |
| | | * 拼多多跳转链接 |
| | | */ |
| | | public class VIPShopJumpLinkVO { |
| | | private String jumpLink; |
| | | private boolean _native; |
| | | private String nativeJumpLink; |
| | | private WXXCXJumpInfoVO wxxcxJumpInfo; |
| | | |
| | | public String getJumpLink() { |
| | | return jumpLink; |
| | | } |
| | | |
| | | public void setJumpLink(String jumpLink) { |
| | | this.jumpLink = jumpLink; |
| | | } |
| | | |
| | | |
| | | public boolean is_native() { |
| | | return _native; |
| | | } |
| | | |
| | | public void set_native(boolean _native) { |
| | | this._native = _native; |
| | | } |
| | | |
| | | public String getNativeJumpLink() { |
| | | return nativeJumpLink; |
| | | } |
| | | |
| | | public void setNativeJumpLink(String nativeJumpLink) { |
| | | this.nativeJumpLink = nativeJumpLink; |
| | | } |
| | | |
| | | public WXXCXJumpInfoVO getWxxcxJumpInfo() { |
| | | return wxxcxJumpInfo; |
| | | } |
| | | |
| | | public void setWxxcxJumpInfo(WXXCXJumpInfoVO wxxcxJumpInfo) { |
| | | this.wxxcxJumpInfo = wxxcxJumpInfo; |
| | | } |
| | | } |