From a7454d8a6325566753358b37ffabfae2faa0ca7f Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 28 四月 2021 19:46:49 +0800 Subject: [PATCH] 拼多多授权调整,支持小程序跳转 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java | 66 +++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 28 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java index cc88c6b..0f9f73e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java @@ -22,6 +22,8 @@ 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; @@ -324,7 +326,7 @@ } // 涓嶆槸鐢↖D鐨勭櫥闄嗙殑浜嬪氨澶氫簡 BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages(),acceptData.getSystem()); + acceptData.getPackages(), acceptData.getSystem()); if (system == null) { out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�")); return; @@ -515,7 +517,7 @@ } // 涓嶆槸鐢↖D鐨勭櫥闄嗙殑浜嬪氨澶氫簡 BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), - acceptData.getPackages(),acceptData.getSystem()); + acceptData.getPackages(), acceptData.getSystem()); if (system == null) { out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�")); return; @@ -573,7 +575,7 @@ 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) { @@ -599,7 +601,7 @@ 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); @@ -609,11 +611,11 @@ } 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; @@ -805,10 +807,10 @@ 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 = ""; @@ -868,9 +870,9 @@ 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 = ""; @@ -1155,14 +1157,14 @@ } 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 + "鍏�")); @@ -1173,7 +1175,7 @@ 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; @@ -1222,7 +1224,7 @@ } 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]; @@ -1710,7 +1712,7 @@ 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 = ""; } @@ -1721,7 +1723,7 @@ 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); @@ -1782,7 +1784,7 @@ 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 = ""; } @@ -1793,7 +1795,7 @@ 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); @@ -1838,7 +1840,7 @@ 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 = ""; } @@ -1855,7 +1857,7 @@ 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); @@ -2020,11 +2022,11 @@ 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(); @@ -2050,7 +2052,7 @@ 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; @@ -2179,7 +2181,7 @@ 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; @@ -2237,7 +2239,7 @@ } 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); @@ -2281,6 +2283,14 @@ } 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)); -- Gitblit v1.8.0