修复更新通知跳转播放页缺少title参数

This commit is contained in:
mtvpls
2026-02-20 11:45:46 +08:00
parent 84fec2eada
commit 71205d98d8
2 changed files with 12 additions and 3 deletions

View File

@@ -323,7 +323,7 @@ async function refreshRecordAndFavorites() {
// 收集更新信息用于邮件
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000';
const playUrl = `${siteUrl}/play?source=${source}&id=${id}`;
const playUrl = `${siteUrl}/play?source=${source}&id=${id}&title=${encodeURIComponent(fav.title)}`;
userUpdates.push({
title: fav.title,
oldEpisodes: fav.total_episodes,

View File

@@ -6,6 +6,7 @@ import { Bell, Check, Trash2, X } from 'lucide-react';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import { getAuthInfoFromBrowserCookie } from '@/lib/auth';
import { Notification } from '@/lib/types';
interface NotificationPanelProps {
@@ -118,8 +119,16 @@ export const NotificationPanel: React.FC<NotificationPanelProps> = ({
// 根据通知类型跳转
if (notification.type === 'favorite_update' && notification.metadata) {
const { source, id } = notification.metadata;
router.push(`/play?source=${source}&id=${id}`);
const { source, id, title } = notification.metadata;
router.push(`/play?source=${source}&id=${id}&title=${encodeURIComponent(title)}`);
onClose();
} else if (notification.type === 'movie_request') {
// 获取用户角色
const authInfo = getAuthInfoFromBrowserCookie();
const isAdmin = authInfo?.role === 'owner' || authInfo?.role === 'admin';
// 管理员跳转到管理面板,普通用户跳转到我的求片
router.push(isAdmin ? '/admin' : '/movie-request');
onClose();
}
};