From aad0425e6a103b633aab4c36642cdd34e95ace62 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 26 八月 2019 09:40:41 +0800
Subject: [PATCH] 推送类型优化

---
 fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java |   37 ++++++++++++++++++++++++++++++-------
 1 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java b/fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java
index 07789d0..fa7b643 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/factory/IOSPushFactory.java
@@ -2,7 +2,7 @@
 
 import java.io.UnsupportedEncodingException;
 
-import com.yeshi.fanli.controller.admin.PushController;
+import com.yeshi.fanli.dto.push.PushTypeEnum;
 import com.yeshi.fanli.util.StringUtil;
 
 import net.sf.json.JSONObject;
@@ -59,7 +59,7 @@
 		alert.put("badge", "1");
 		alert.put("sound", "default");
 		alert.put("url", "http://id=" + auctionId);
-		alert.put("type", PushController.GOODS);
+		alert.put("type",PushTypeEnum.goodsdetail.getCode());
 
 		JSONObject aps = new JSONObject();
 		aps.put("alert", alert);
@@ -82,7 +82,7 @@
 		alert.put("body", body);
 		alert.put("badge", "1");
 		alert.put("sound", "default");
-		alert.put("type", PushController.ZNX);
+		alert.put("type", PushTypeEnum.ZNX.getCode());
 		JSONObject aps = new JSONObject();
 		aps.put("alert", alert);
 		//aps.put("badge", 1);
@@ -106,7 +106,7 @@
 		alert.put("body", body);
 		alert.put("badge", "1");
 		alert.put("sound", "default");
-		alert.put("type", PushController.URL);
+		alert.put("type",PushTypeEnum.url.getCode());
 		alert.put("url", shortUrl);
 
 		JSONObject aps = new JSONObject();
@@ -131,7 +131,7 @@
 		alert.put("body", body);
 		alert.put("badge", "1");
 		alert.put("sound", "default");
-		alert.put("type", PushController.WEEX);
+		alert.put("type", PushTypeEnum.weex.getCode());
 		alert.put("url", shortUrl);
 
 		JSONObject aps = new JSONObject();
@@ -156,7 +156,7 @@
 		alert.put("body", body);
 		alert.put("badge", "1");
 		alert.put("sound", "default");
-		alert.put("type", PushController.BAICHUAN);
+		alert.put("type", PushTypeEnum.baichuan.getCode());
 		alert.put("url", shortUrl);
 
 		JSONObject aps = new JSONObject();
@@ -179,7 +179,7 @@
 		alert.put("body", body);
 		alert.put("badge", "1");
 		alert.put("sound", "default");
-		alert.put("type", PushController.WELFARE_CENTER);
+		alert.put("type", PushTypeEnum.welfare.getCode());
 
 		JSONObject aps = new JSONObject();
 		aps.put("alert", alert);
@@ -189,4 +189,27 @@
 		return filterPushContent(json);
 	}
 
+	
+	/**
+	 * 鐢ㄦ埛绛惧埌
+	 * @param title
+	 * @param body
+	 * @return
+	 */
+	public static JSONObject createUserSignInPush( String title, String body) {
+		JSONObject alert = new JSONObject();
+		alert.put("title", title);
+		alert.put("body", body);
+		alert.put("badge", "1");
+		alert.put("sound", "default");
+		alert.put("type", PushTypeEnum.signin.getCode());
+
+		JSONObject aps = new JSONObject();
+		aps.put("alert", alert);
+		//aps.put("badge", 1);
+		JSONObject json = new JSONObject();
+		json.put("aps", aps);
+		return filterPushContent(json);
+	}
+	
 }

--
Gitblit v1.8.0