From 60360bfb6bd56d42a4e4ea313730ddb29b3807a1 Mon Sep 17 00:00:00 2001 From: chenxing Date: Mon, 17 Aug 2026 20:13:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunhai/userbase/service/push/PushDispatcher.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/yunhai/userbase/service/push/PushDispatcher.java b/src/main/java/com/yunhai/userbase/service/push/PushDispatcher.java index 2e4bc9a..c69e0cd 100644 --- a/src/main/java/com/yunhai/userbase/service/push/PushDispatcher.java +++ b/src/main/java/com/yunhai/userbase/service/push/PushDispatcher.java @@ -77,7 +77,7 @@ public class PushDispatcher { users = sysUserRepository.findAll(); } for (ApplicationInfo app : applicationInfoRepository.findByPushEnabled(1)) { - dispatchToOne(app, type, groups, users, "auto"); + dispatchToOne(app, type, groups, users, "auto", false); } } catch (Exception e) { log.error("[推送] 分发失败(不影响主业务)", e); @@ -108,7 +108,9 @@ public class PushDispatcher { users = (targetIds == null || targetIds.isEmpty()) ? sysUserRepository.findAll() : sysUserRepository.findAllById(targetIds); } - dispatchToOne(app, type, groups, users, "manual"); + // 手动全量同步(SyncGroup/SyncUser)属于管理员主动触发,绕过订阅接口开关,确保一定能投递 + boolean force = (type == PushInterfaceType.SYNC_GROUP || type == PushInterfaceType.SYNC_USER); + dispatchToOne(app, type, groups, users, "manual", force); } /** @@ -176,11 +178,13 @@ public class PushDispatcher { // ===================== 核心 ===================== private void dispatchToOne(ApplicationInfo app, PushInterfaceType type, - List groups, List users, String triggerType) { + List groups, List users, String triggerType, boolean force) { if (app.getPushEnabled() == null || app.getPushEnabled() != 1) { return; } - if (!containsEventType(app.getPushEventTypes(), type.getPath())) { + // 手动全量同步为管理员主动触发,绕过订阅接口开关(force=true); + // 自动/增量事件仍要求订阅方在 pushEventTypes 中勾选对应接口。 + if (!force && !containsEventType(app.getPushEventTypes(), type.getPath())) { return; } boolean isFull = (type == PushInterfaceType.SYNC_GROUP || type == PushInterfaceType.SYNC_USER);