diff --git a/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java b/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java index 3dffffcd3..781fc0776 100644 --- a/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java +++ b/src/main/java/au/com/royalpay/payment/manage/pushMessage/APNSMessageHelper.java @@ -9,6 +9,8 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -21,14 +23,14 @@ public class APNSMessageHelper { @Value("classpath:apple_message_cert_dev.p12") private org.springframework.core.io.Resource appleMessageFileDev; - @Value("classpath:apple_message_cert_product.p12") - private org.springframework.core.io.Resource appleMessageFileProduct; + @Value("${apple.message.apns.file}") + private String appleApnsFile; @Value("${apple.message.apns.password}") private String appleMessagePassword; public void sendAppleMessage(String title, String body, String token, JSONObject data, JSONObject type) throws IOException { /**设置参数,发送数据**/ - InputStream keyIns = appleMessageFileProduct.getInputStream(); + InputStream keyIns = new FileInputStream(new File(appleApnsFile)); ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build(); String payload = APNS.newPayload().alertTitle(title).alertBody(body).badge(1).sound("default").customField("data", data).customField("type", type).build(); service.push(token, payload); @@ -37,7 +39,7 @@ public class APNSMessageHelper { public void sendAppleMessageDetail(String title, String body, String token, JSONObject data, JSONObject type) throws IOException { /**设置参数,发送数据**/ - InputStream keyIns = appleMessageFileProduct.getInputStream(); + InputStream keyIns = new FileInputStream(new File(appleApnsFile)); ApnsService service = APNS.newService().withCert(keyIns, appleMessagePassword).withProductionDestination().build(); String payload = APNS.newPayload().alertTitle(title).alertBody(body).category("myNotificationCategory").badge(1).sound("default").customField("data", data).customField("type", type).build(); service.push(token, payload); diff --git a/src/main/resources/apple_message_cert_product.p12 b/src/main/resources/apple_message_cert_product.p12 deleted file mode 100644 index 905e2cc1f..000000000 Binary files a/src/main/resources/apple_message_cert_product.p12 and /dev/null differ diff --git a/src/main/resources/apple_message_cert_product20180413.p12 b/src/main/resources/apple_message_cert_product20180413.p12 deleted file mode 100644 index 58c694512..000000000 Binary files a/src/main/resources/apple_message_cert_product20180413.p12 and /dev/null differ