修复通知生成依赖JPush设备RID的缺陷:通知列表面向全部激活用户,推送仅作附加通道;历史通知已读标记与回填
This commit is contained in:
@@ -85,7 +85,7 @@ class ApiClient {
|
||||
);
|
||||
}
|
||||
|
||||
static const _kBasePref = 'xl_api_base_v3'; // v3:旧地址记忆不迁移
|
||||
static const _kBasePref = 'xl_api_base_v4'; // v3:旧地址记忆不迁移
|
||||
final TokenStore _tokens;
|
||||
late final Dio _dio;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'core/storage/token_store.dart';
|
||||
import 'core/theme/app_theme.dart';
|
||||
import 'features/auth/auth_controller.dart' show authStageProvider;
|
||||
import 'features/home/home_page.dart';
|
||||
import 'core/widgets/debug_overlay.dart' show DebugOverlay;
|
||||
import 'features/misc/system_pages.dart';
|
||||
import 'features/settings/settings_page.dart';
|
||||
|
||||
@@ -86,6 +87,10 @@ class _XuanlongAppState extends ConsumerState<XuanlongApp> {
|
||||
theme: buildXlTheme(),
|
||||
routerConfig: router,
|
||||
debugShowCheckedModeBanner: false,
|
||||
// 测试版:--dart-define=DEBUG_OVERLAY=true 打开日志悬浮窗
|
||||
builder: (context, child) => const bool.fromEnvironment('DEBUG_OVERLAY')
|
||||
? DebugOverlay(child: child ?? const SizedBox.shrink())
|
||||
: (child ?? const SizedBox.shrink()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,17 +27,21 @@ def _in_dnd(user: dict, now: datetime) -> bool:
|
||||
|
||||
|
||||
def _targets(conn) -> list[dict]:
|
||||
"""已激活 + 未封禁 + 推送开 + 非免打扰 的设备列表。"""
|
||||
"""已激活 + 未封禁 + 推送开 + 非免打扰 的用户列表。
|
||||
|
||||
注意:App 内通知列表面向所有激活用户,不依赖 JPush 设备注册——
|
||||
RID 为空只影响 push_pending 能否推送,不影响通知行生成。
|
||||
(原实现 JOIN devices 且要求 jpush_rid 非空,导致未接 JPush 时
|
||||
所有用户的通知列表永远为空。)"""
|
||||
now = _now()
|
||||
now_s = now.strftime("%Y-%m-%d %H:%M:%S")
|
||||
rows = conn.execute(
|
||||
"""
|
||||
SELECT u.id AS user_id, d.id AS device_id, d.jpush_rid,
|
||||
SELECT u.id AS user_id,
|
||||
COALESCE(s.push_enabled,1) AS push_enabled,
|
||||
COALESCE(s.dnd_enabled,0) AS dnd_enabled,
|
||||
s.dnd_start, s.dnd_end
|
||||
FROM users u
|
||||
JOIN devices d ON d.user_id = u.id AND d.rid_invalid = 0 AND d.jpush_rid IS NOT NULL
|
||||
LEFT JOIN user_settings s ON s.user_id = u.id
|
||||
WHERE u.is_banned = 0 AND u.active_until >= ?
|
||||
""",
|
||||
|
||||
Reference in New Issue
Block a user