| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 方法说明: IOS 多推 |
| | | * |
| | | * @author mawurui createTime 2018年5月8日 上午10:19:57 |
| | | * @param deviceToken |
| | | * @param packages |
| | | * @param alert |
| | | * @return |
| | | * @throws Exception |
| | | * @author mawurui createTime 2018年5月8日 上午10:19:57 |
| | | */ |
| | | public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type) |
| | | public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type, String pwd) |
| | | throws Exception { |
| | | |
| | | // if (Constant.IS_TEST) |
| | |
| | | |
| | | InputStream certificate = IOSPushUtil.class.getClassLoader() |
| | | .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件 |
| | | String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd(); |
| | | String certificatePassword = pwd; |
| | | if (tokenList != null && tokenList.size() > 0) { |
| | | int pageSize = 50; |
| | | int page = tokenList.size() % pageSize == 0 ? tokenList.size() / pageSize : tokenList.size() / pageSize + 1; |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @author mawurui createTime 2018年5月8日 下午12:12:19 |
| | | * @param info |
| | | * @param json |
| | | * @param pushRecord |
| | | * @return |
| | | * @throws Exception |
| | | * @author mawurui createTime 2018年5月8日 下午12:12:19 |
| | | */ |
| | | public static int allFanLiQuanDevice(System b_IOS, List<String> deviceTokenList, String PACKAGES, String title, |
| | | String content, String url, PushRecord pushRecord, int type) throws Exception { |
| | | String content, String url, PushRecord pushRecord, int type,String pwd) throws Exception { |
| | | |
| | | return pushApp(deviceTokenList, PACKAGES, title, content, b_IOS, url, pushRecord, type); |
| | | return pushApp(deviceTokenList, PACKAGES, title, content, b_IOS, url, pushRecord, type,pwd); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param info |
| | | * @param params |
| | | * @param pushRecord |
| | |
| | | * @throws Exception |
| | | */ |
| | | private static int pushApp(List<String> deviceTokenList, String PACKAGES, String title, String content, |
| | | System b_IOS, String url, PushRecord pushRecord, int type) throws Exception { |
| | | System b_IOS, String url, PushRecord pushRecord, int type, String pwd) throws Exception { |
| | | MessageInfo info = new MessageInfo(); |
| | | info.setTitle(title); |
| | | info.setContent(content); |
| | | String IOS = allPushIOS(deviceTokenList, info, url, type); |
| | | String IOS = allPushIOS(deviceTokenList, info, url, type, pwd); |
| | | LogHelper.userInfo("IOS的推送日志:" + IOS); |
| | | pushRecord.setIosPushId(IOS); |
| | | if (IOS != null) { |
| | |
| | | * @param json |
| | | * @throws Exception |
| | | */ |
| | | public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception { |
| | | public static void executePushIOS(List<String> tokenList, JSONObject json, String pwd) throws Exception { |
| | | InputStream certificate = IOSPushUtil.class.getClassLoader() |
| | | .getResourceAsStream("certificate/pushCertificate.p12"); // 读取.p12文件 |
| | | String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd(); |
| | | String certificatePassword = pwd; |
| | | pushIOS(tokenList, json, certificate, certificatePassword); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 方法说明: IOS 多推 |
| | | * |
| | | * @author mawurui createTime 2018年5月8日 上午10:19:57 |
| | | * @param deviceToken |
| | | * @param packages |
| | | * @param alert |
| | | * @return |
| | | * @throws Exception |
| | | * @author mawurui createTime 2018年5月8日 上午10:19:57 |
| | | */ |
| | | public static JSONObject getJSONObject(MessageInfo info, String url, int type) throws Exception { |
| | | |