From 5981b2cae7c20ec9021c8ccbe1a926f35f640210 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 03 一月 2019 17:43:18 +0800 Subject: [PATCH] Merge branch 'dev-hongbao' --- fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java | 39 +++++++++++++++++++++++++++++++-------- 1 files changed, 31 insertions(+), 8 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java index 5a7afed..e6dff06 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java @@ -88,6 +88,16 @@ json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent()); } else if (type == PushController.ZNX) { json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent()); + } else if (type == PushController.WEEX) { + String shortUrl = HttpUtil.getShortLink(url); + if (StringUtil.isNullOrEmpty(shortUrl)) + throw new Exception("鑾峰彇鐭摼鍑洪敊"); + json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent()); + } else if (type == PushController.BAICHUAN) { + String shortUrl = HttpUtil.getShortLink(url); + if (StringUtil.isNullOrEmpty(shortUrl)) + throw new Exception("鑾峰彇鐭摼鍑洪敊"); + json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent()); } // 鍒嗙粍鎺ㄩ�� 姣�50涓澶囦负涓�缁� @@ -138,7 +148,12 @@ PushNotificationManager pushManager = new PushNotificationManager(); // true锛氳〃绀虹殑鏄骇鍝佺嚎涓婂彂甯冩帹閫佹湇鍔� false锛氳〃绀虹殑鏄骇鍝佹祴璇曟帹閫佹湇鍔� - pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePassword, true)); + if (Constant.IS_TEST) + pushManager.initializeConnection( + new AppleNotificationServerBasicImpl(certificate, certificatePassword, false)); + else + pushManager + .initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePassword, true)); List<Device> deviceList = new ArrayList<Device>(); for (String token : tokenList) { @@ -193,19 +208,18 @@ return 4; } } - - + /** * 鎵ц鎺ㄩ�� + * * @param tokenList * @param json * @throws Exception */ - public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception{ + public static void executePushIOS(List<String> tokenList, JSONObject json) throws Exception { pushIOS(tokenList, json); } - - + /** * * 鏂规硶璇存槑: IOS 澶氭帹 @@ -217,8 +231,7 @@ * @return * @throws Exception */ - public static JSONObject getJSONObject(MessageInfo info, String url, int type) - throws Exception { + public static JSONObject getJSONObject(MessageInfo info, String url, int type) throws Exception { // json鑷畾涔変紶鍊� JSONObject json = null; @@ -242,6 +255,16 @@ json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent()); } else if (type == PushController.ZNX) { json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent()); + } else if (type == PushController.WEEX) { + String shortUrl = HttpUtil.getShortLink(url); + if (StringUtil.isNullOrEmpty(shortUrl)) + shortUrl = url; + json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent()); + } else if (type == PushController.BAICHUAN) { + String shortUrl = HttpUtil.getShortLink(url); + if (StringUtil.isNullOrEmpty(shortUrl)) + shortUrl = url; + json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent()); } return json; -- Gitblit v1.8.0