From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/util/push/IOSPushUtil.java |   51 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 30 insertions(+), 21 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 75ee70b..af963df 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
@@ -12,6 +12,7 @@
 
 import com.google.gson.Gson;
 import com.yeshi.fanli.controller.admin.PushController;
+import com.yeshi.fanli.dto.push.PushTypeEnum;
 import com.yeshi.fanli.entity.xinge.MessageInfo;
 import com.yeshi.fanli.entity.xinge.PushRecord;
 import com.yeshi.fanli.log.LogHelper;
@@ -57,6 +58,9 @@
 	public static String allPushIOS(List<String> deviceTokenList, MessageInfo info, String url, int type)
 			throws Exception {
 
+		// if (Constant.IS_TEST)
+		// return null;
+
 		Gson gson = new Gson();
 		PushLogHelper.iosInfo("IOS鎺ㄩ�佽澶囨暟涓�:" + deviceTokenList.size());
 		PushLogHelper.iosInfo("IOS鎺ㄩ�佺殑鍐呭涓猴細" + gson.toJson(info));
@@ -67,7 +71,7 @@
 		// json鑷畾涔変紶鍊�
 
 		JSONObject json = null;
-		if (type == PushController.GOODS) {
+		if (type == PushTypeEnum.goodsdetail.getCode()) {
 			Long auctionId = null;
 			if (url.contains("id=")) {
 				String[] sts = url.split("\\?")[1].split("&");
@@ -80,26 +84,30 @@
 			if (auctionId == null)
 				throw new Exception("娣樺疂鍟嗗搧ID鎻愬彇鍑洪敊");
 			json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
-		} else if (type == PushController.URL) {
+		} else if (type == PushTypeEnum.url.getCode()) {
 			String shortUrl = HttpUtil.getShortLink(url);
 			if (StringUtil.isNullOrEmpty(shortUrl))
 				throw new Exception("鑾峰彇鐭摼鍑洪敊");
 			json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
-		} else if (type == PushController.ZNX) {
+		} else if (type == PushTypeEnum.ZNX.getCode()) {
 			json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
-		} else if (type == PushController.WEEX) {
+		} else if (type == PushTypeEnum.weex.getCode()) {
 			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("鑾峰彇鐭摼鍑洪敊");
+		} else if (type == PushTypeEnum.baichuan.getCode()) {
+			String shortUrl = url;
+			// HttpUtil.getShortLink(url);
+			// if (StringUtil.isNullOrEmpty(shortUrl))
+			// throw new Exception("鑾峰彇鐭摼鍑洪敊");
 			json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
-		} else if (type == PushController.WELFARE_CENTER) {
+		} else if (type == PushTypeEnum.welfare.getCode()) {
 			json = IOSPushFactory.createWelfarePush(info.getTitle(), info.getContent());
+		} else if (type == PushTypeEnum.signin.getCode()) {
+			json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
 		}
+
 		// 鍒嗙粍鎺ㄩ�� 姣�50涓澶囦负涓�缁�
 
 		InputStream certificate = IOSPushUtil.class.getClassLoader()
@@ -113,7 +121,7 @@
 				int end = start + pageSize;
 				if (end > tokenList.size())
 					end = tokenList.size();
-				pushIOS(tokenList.subList(start, end), json,certificate,certificatePassword);
+				pushIOS(tokenList.subList(start, end), json, certificate, certificatePassword);
 			}
 
 		}
@@ -121,7 +129,8 @@
 		return null;
 	}
 
-	public static String pushIOS(List<String> deviceTokenList, JSONObject json,InputStream certificate,String certificatePWD) throws Exception {
+	public static String pushIOS(List<String> deviceTokenList, JSONObject json, InputStream certificate,
+			String certificatePWD) throws Exception {
 		List<String> tokenList = new ArrayList<String>();
 		for (String deviceToken : deviceTokenList) {
 			tokenList.add(deviceToken);
@@ -150,11 +159,9 @@
 		PushNotificationManager pushManager = new PushNotificationManager();
 		// true锛氳〃绀虹殑鏄骇鍝佺嚎涓婂彂甯冩帹閫佹湇鍔� false锛氳〃绀虹殑鏄骇鍝佹祴璇曟帹閫佹湇鍔�
 		if (Constant.IS_TEST)
-			pushManager.initializeConnection(
-					new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
+			pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, false));
 		else
-			pushManager
-					.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
+			pushManager.initializeConnection(new AppleNotificationServerBasicImpl(certificate, certificatePWD, true));
 
 		List<Device> deviceList = new ArrayList<Device>();
 		for (String token : tokenList) {
@@ -221,7 +228,7 @@
 		InputStream certificate = IOSPushUtil.class.getClassLoader()
 				.getResourceAsStream("certificate/pushCertificate.p12"); // 璇诲彇.p12鏂囦欢
 		String certificatePassword = Constant.systemCommonConfig.getIosPushCertificatePwd();
-		pushIOS(tokenList, json,certificate,certificatePassword);
+		pushIOS(tokenList, json, certificate, certificatePassword);
 	}
 
 	/**
@@ -239,7 +246,7 @@
 
 		// json鑷畾涔変紶鍊�
 		JSONObject json = null;
-		if (type == PushController.GOODS) {
+		if (type == PushTypeEnum.goodsdetail.getCode()) {
 			Long auctionId = null;
 			if (url.contains("id=")) {
 				String[] sts = url.split("\\?")[1].split("&");
@@ -252,23 +259,25 @@
 			if (auctionId == null)
 				throw new Exception("娣樺疂鍟嗗搧ID鎻愬彇鍑洪敊");
 			json = IOSPushFactory.createGoodsPush(auctionId, info.getTitle(), info.getContent());
-		} else if (type == PushController.URL) {
+		} else if (type == PushTypeEnum.url.getCode()) {
 			String shortUrl = HttpUtil.getShortLink(url);
 			if (StringUtil.isNullOrEmpty(shortUrl))
 				throw new Exception("鑾峰彇鐭摼鍑洪敊");
 			json = IOSPushFactory.createURLPush(shortUrl, info.getTitle(), info.getContent());
-		} else if (type == PushController.ZNX) {
+		} else if (type == PushTypeEnum.ZNX.getCode()) {
 			json = IOSPushFactory.createZNXPush(info.getTitle(), info.getContent());
-		} else if (type == PushController.WEEX) {
+		} else if (type == PushTypeEnum.weex.getCode()) {
 			String shortUrl = HttpUtil.getShortLink(url);
 			if (StringUtil.isNullOrEmpty(shortUrl))
 				shortUrl = url;
 			json = IOSPushFactory.createWEEXPush(shortUrl, info.getTitle(), info.getContent());
-		} else if (type == PushController.BAICHUAN) {
+		} else if (type == PushTypeEnum.baichuan.getCode()) {
 			String shortUrl = HttpUtil.getShortLink(url);
 			if (StringUtil.isNullOrEmpty(shortUrl))
 				shortUrl = url;
 			json = IOSPushFactory.createBaiChuanPush(shortUrl, info.getTitle(), info.getContent());
+		} else if (type == PushTypeEnum.signin.getCode()) {
+			json = IOSPushFactory.createUserSignInPush(info.getTitle(), info.getContent());
 		}
 
 		return json;

--
Gitblit v1.8.0