Forráskód Böngészése

add
苹果手机报警推送

18339543638 1 éve
szülő
commit
ebcfbbca6e

+ 3 - 6
nb-service/app-assistant/src/main/java/com/nb/app/assistant/service/LocalAppIphoneService.java

@@ -5,14 +5,11 @@ import com.nb.app.assistant.api.bean.DeviceAlarmBean;
 import com.nb.app.assistant.api.feign.IAppIphoneClient;
 import com.nb.app.assistant.dto.IphoneDeviceDTO;
 import com.nb.app.assistant.utils.ApnsUtils;
-import lombok.AllArgsConstructor;
 import org.redisson.api.RSet;
 import org.redisson.api.RedissonClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
-
 import java.util.Set;
 
 /**
@@ -31,12 +28,12 @@ public class LocalAppIphoneService implements IAppIphoneClient {
     private LocalAppIphoneService self;
 
     public void addDeviceToken(IphoneDeviceDTO source){
-        RSet<String> tenantSet = redissonClient.getSet(source.getTenantId());
+        RSet<String> tenantSet = redissonClient.getSet("ios:"+source.getTenantId());
         tenantSet.add(source.getDeviceToken());
     }
 
     public void removeDeviceToken(IphoneDeviceDTO source){
-        RSet<String> tenantSet = redissonClient.getSet(source.getTenantId());
+        RSet<String> tenantSet = redissonClient.getSet("ios:"+source.getTenantId());
         tenantSet.remove(source.getDeviceToken());
     }
 
@@ -46,7 +43,7 @@ public class LocalAppIphoneService implements IAppIphoneClient {
     }
 
     public void sendMsg(String tenantId, DeviceAlarmBean source){
-        RSet<String> tenantSet = redissonClient.getSet(tenantId);
+        RSet<String> tenantSet = redissonClient.getSet("ios:"+tenantId);
         Set<String> deviceTokenSet = tenantSet.readAll();
         if (CollectionUtil.isNotEmpty(deviceTokenSet)) {
             deviceTokenSet.parallelStream()

+ 1 - 4
nb-service/app-assistant/src/main/java/com/nb/app/assistant/utils/ApnsUtils.java

@@ -12,13 +12,10 @@ import io.netty.channel.nio.NioEventLoopGroup;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
-
 import java.io.File;
 import java.net.URL;
 import java.util.Date;
 import java.util.UUID;
-
-import static com.turo.pushy.apns.PushType.*;
 import static com.turo.pushy.apns.PushType.ALERT;
 
 
@@ -62,7 +59,7 @@ public class ApnsUtils {
         //如果失败不必惊慌,rejectionReason字段中会有失败的原因。对应官网找到原因即可
         //https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns?language=objc
 
-        log.info("------------->"+response);
+        log.info("IOS云响应------------->"+response);
 
 
     }