From 81da61b828e29b7745e1382dfbbaeb685dc083ef Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 23 一月 2024 17:17:55 +0800 Subject: [PATCH] 抖音转链修改 --- fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java | 322 ++++++++++++++++++++++++++-------------------------- 1 files changed, 161 insertions(+), 161 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java b/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java index 8c287bd..cc9c5bc 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/push/PushUtils.java @@ -1,161 +1,161 @@ -package com.yeshi.fanli.util.push; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; - -import com.yeshi.fanli.entity.xinge.MessageInfo; -import com.yeshi.fanli.entity.xinge.PushRecord; -import com.yeshi.fanli.log.LogHelper; -import com.yeshi.fanli.service.inter.push.PushService; -import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.StringUtil; - -import net.sf.json.JSONObject; - -public class PushUtils { - - @Resource - private PushService pushService; - - /** - * 灏忕背鍏ㄦ帹 - * - * @param info - * @param json - * @param pushRecord - * @return - * @throws Exception - */ - public static int allPushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) throws Exception { - - if (Constant.IS_TEST) - return 1; - - JSONObject mapXm = JSONObject.fromObject(json); - String android = XiaoMiPushUtil.allPushAndroidForXM(info, mapXm); - - LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); - pushRecord.setAndroidPushId(android); - - if (android != null) { - return 1; - } else { - return 4; - } - } - - /** - * IOS 鍏ㄦ帹閫� - * - * @param info - * @param json - * @param pushRecord - * @param type - * @param deviceTokenList - * @return - * @throws Exception - */ - public static int allPushIOS(MessageInfo info, PushRecord pushRecord, String url, int type, - List<String> deviceTokenList) throws Exception { - - /* - * com.yeshi.fanli.entity.system.System b_IOS = - * systemService.getSystem("IOS", - * Constant.systemCommonConfig.getIosBundleId()); - */ - - if (Constant.IS_TEST) - return 1; - - String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type); - LogHelper.userInfo("IOS鐨勬帹閫佹棩蹇楋細" + IOS); - pushRecord.setIosPushId(IOS); - - if (IOS != null) { - return 1; - } else { - return 4; - } - } - - /** - * 灏忕背鍗曟帹 - * - * @param info - * @param json - * @return - */ - public static int singlePushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) { - if (Constant.IS_TEST) - return 1; - - JSONObject mapXm = JSONObject.fromObject(json); - - String android = XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm, null); - - LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); - pushRecord.setAndroidPushId(android); - - if (android != null) { - return 1; - } else { - return 4; - } - } - - public static int singlePushXiaoMiByRegisterId(MessageInfo info, JSONObject json, PushRecord pushRecord, - String regId) { - if (Constant.IS_TEST) - return 1; - - JSONObject mapXm = JSONObject.fromObject(json); - - List<String> regIdList = new ArrayList<>(); - regIdList.add(regId); - String android = XiaoMiPushUtil.pushBatchAndroidForXM(info, mapXm, regIdList); - - LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); - pushRecord.setAndroidPushId(android); - - if (android != null) { - return 1; - } else { - return 4; - } - } - - /** - * IOS 鍗曟帹 - * - * @param info - * @param url - * @param type - * @param deviceTokenList - * @return - */ - public static String singlePushIOS(MessageInfo info, PushRecord pushRecord, String url, int type, - List<String> deviceTokenList) { - if (Constant.IS_TEST) - return null; - if (deviceTokenList != null && deviceTokenList.size() > 0) { - for (String deviceToken : deviceTokenList) { - if (!StringUtil.isNullOrEmpty(deviceToken)) { - try { - List<String> deviceList = new ArrayList<>(); - deviceList.add(deviceToken); - String IOS = IOSPushUtil.allPushIOS(deviceList, info, url, type); - pushRecord.setIosPushId(IOS); - } catch (Exception e) { - e.printStackTrace(); - } - } - - } - } - - return null; - } - -} +package com.yeshi.fanli.util.push; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import com.yeshi.fanli.entity.xinge.MessageInfo; +import com.yeshi.fanli.entity.xinge.PushRecord; +import com.yeshi.fanli.log.LogHelper; +import com.yeshi.fanli.service.inter.push.PushService; +import com.yeshi.fanli.util.Constant; +import com.yeshi.fanli.util.StringUtil; + +import net.sf.json.JSONObject; + +public class PushUtils { + + @Resource + private PushService pushService; + + /** + * 灏忕背鍏ㄦ帹 + * + * @param info + * @param json + * @param pushRecord + * @return + * @throws Exception + */ + public static int allPushXiaoMi(MessageInfo info, JSONObject json, PushRecord pushRecord) throws Exception { + + if (Constant.IS_TEST) + return 1; + + JSONObject mapXm = JSONObject.fromObject(json); + String android = XiaoMiPushUtil.allPushAndroidForXM(info, mapXm); + + LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); + pushRecord.setAndroidPushId(android); + + if (android != null) { + return 1; + } else { + return 4; + } + } + + /** + * IOS 鍏ㄦ帹閫� + * + * @param info + * @param json + * @param pushRecord + * @param type + * @param deviceTokenList + * @return + * @throws Exception + */ + public static int allPushIOS(MessageInfo info, PushRecord pushRecord, String url, int type, + List<String> deviceTokenList,String pwd) throws Exception { + + /* + * com.yeshi.fanli.entity.system.System b_IOS = + * systemService.getSystem("IOS", + * Constant.systemCommonConfig.getIosBundleId()); + */ + + if (Constant.IS_TEST) + return 1; + + String IOS = IOSPushUtil.allPushIOS(deviceTokenList, info, url, type,pwd); + LogHelper.userInfo("IOS鐨勬帹閫佹棩蹇楋細" + IOS); + pushRecord.setIosPushId(IOS); + + if (IOS != null) { + return 1; + } else { + return 4; + } + } + + /** + * 灏忕背鍗曟帹 + * + * @param info + * @param json + * @return + */ + public static int singlePushXiaoMi(MessageInfo info, JSONObject json,List<String> regIds, PushRecord pushRecord) { +// if (Constant.IS_TEST) +// return 1; + + JSONObject mapXm = JSONObject.fromObject(json); + + String android = XiaoMiPushUtil.singlePushAndroidForXM(info, mapXm,regIds, null); + + LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); + pushRecord.setAndroidPushId(android); + + if (android != null) { + return 1; + } else { + return 4; + } + } + + public static int singlePushXiaoMiByRegisterId(MessageInfo info, JSONObject json, PushRecord pushRecord, + String regId) { + if (Constant.IS_TEST) + return 1; + + JSONObject mapXm = JSONObject.fromObject(json); + + List<String> regIdList = new ArrayList<>(); + regIdList.add(regId); + String android = XiaoMiPushUtil.pushBatchAndroidForXM(info, mapXm, regIdList); + + LogHelper.userInfo("瀹夊崜鎺ㄩ�佹祴璇曪細" + android); + pushRecord.setAndroidPushId(android); + + if (android != null) { + return 1; + } else { + return 4; + } + } + + /** + * IOS 鍗曟帹 + * + * @param info + * @param url + * @param type + * @param deviceTokenList + * @return + */ + public static String singlePushIOS(MessageInfo info, PushRecord pushRecord, String url, int type, + List<String> deviceTokenList, String pwd) { + if (Constant.IS_TEST) + return null; + if (deviceTokenList != null && deviceTokenList.size() > 0) { + for (String deviceToken : deviceTokenList) { + if (!StringUtil.isNullOrEmpty(deviceToken)) { + try { + List<String> deviceList = new ArrayList<>(); + deviceList.add(deviceToken); + String IOS = IOSPushUtil.allPushIOS(deviceList, info, url, type,pwd); + pushRecord.setIosPushId(IOS); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + } + + return null; + } + +} -- Gitblit v1.8.0