From c23c6a7088ce89750aa76385a64520009c0af39b Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 19 Jun 2023 11:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=9F=A5=E8=AF=A2=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E5=92=8C=E7=A7=AF=E5=88=86=E8=BF=94=E5=88=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hfkj/unipush/UniPushService.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/com/hfkj/unipush/UniPushService.java b/service/src/main/java/com/hfkj/unipush/UniPushService.java index dcc2af6..512028c 100644 --- a/service/src/main/java/com/hfkj/unipush/UniPushService.java +++ b/service/src/main/java/com/hfkj/unipush/UniPushService.java @@ -7,8 +7,13 @@ import com.getui.push.v2.sdk.GtApiConfiguration; import com.getui.push.v2.sdk.api.PushApi; import com.getui.push.v2.sdk.common.ApiResult; import com.getui.push.v2.sdk.dto.req.Audience; +import com.getui.push.v2.sdk.dto.req.message.PushChannel; import com.getui.push.v2.sdk.dto.req.message.PushDTO; import com.getui.push.v2.sdk.dto.req.message.PushMessage; +import com.getui.push.v2.sdk.dto.req.message.android.AndroidDTO; +import com.getui.push.v2.sdk.dto.req.message.android.GTNotification; +import com.getui.push.v2.sdk.dto.req.message.android.ThirdNotification; +import com.getui.push.v2.sdk.dto.req.message.android.Ups; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +68,30 @@ public class UniPushService { // 设置个推通道参数 PushMessage pushMessage = new PushMessage(); pushDTO.setPushMessage(pushMessage); - pushMessage.setTransmission(object.getString("body")); + + // 个推推送消息参数 + GTNotification notification = new GTNotification(); + pushMessage.setNotification(notification); + notification.setTitle("惠支付"); + notification.setBody(object.getString("body")); + notification.setClickType("startapp"); + + /**** 设置厂商相关参数 ****/ + PushChannel pushChannel = new PushChannel(); + pushDTO.setPushChannel(pushChannel); + /*配置安卓厂商参数*/ + AndroidDTO androidDTO = new AndroidDTO(); + pushChannel.setAndroid(androidDTO); + Ups ups = new Ups(); + androidDTO.setUps(ups); + ThirdNotification thirdNotification = new ThirdNotification(); + ups.setNotification(thirdNotification); + thirdNotification.setTitle("T惠支付"); + thirdNotification.setBody(object.getString("body")); + thirdNotification.setClickType("startapp"); + /*配置安卓厂商参数结束,更多参数请查看文档或对象源码*/ + + /*设置接收人信息*/ Audience audience = new Audience(); pushDTO.setAudience(audience);