prepare("UPDATE notifications SET is_read = TRUE WHERE id = ? AND user_id = ?"); $stmt->execute([$notification_id, $_SESSION['user_id']]); header('Location: notifications.php'); exit; } // 标记所有为已读 if (isset($_POST['mark_all_read'])) { $stmt = $pdo->prepare("UPDATE notifications SET is_read = TRUE WHERE user_id = ?"); $stmt->execute([$_SESSION['user_id']]); header('Location: notifications.php'); exit; } // 删除通知 if (isset($_GET['delete'])) { $notification_id = intval($_GET['delete']); $stmt = $pdo->prepare("DELETE FROM notifications WHERE id = ? AND user_id = ?"); $stmt->execute([$notification_id, $_SESSION['user_id']]); header('Location: notifications.php'); exit; } // 获取通知列表 $notifications = getUserNotifications($_SESSION['user_id'], 50); $unreadCount = getUnreadNotificationCount($_SESSION['user_id']); $userSettings = getUserSettings($_SESSION['user_id']); ?>
您还没有收到任何通知