@@ -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<SysGroup> groups, List<SysUser> users, String triggerType) {
|
||||
List<SysGroup> groups, List<SysUser> 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);
|
||||
|
||||
Reference in New Issue
Block a user