diff --git a/src/app/api/cron/[password]/route.ts b/src/app/api/cron/[password]/route.ts index a5ddee1..cd40b34 100644 --- a/src/app/api/cron/[password]/route.ts +++ b/src/app/api/cron/[password]/route.ts @@ -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, diff --git a/src/components/NotificationPanel.tsx b/src/components/NotificationPanel.tsx index 6231c47..33aa8a5 100644 --- a/src/components/NotificationPanel.tsx +++ b/src/components/NotificationPanel.tsx @@ -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 = ({ // 根据通知类型跳转 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(); } };