From 71205d98d858ed4d80c92d1690c45164c06333f9 Mon Sep 17 00:00:00 2001 From: mtvpls Date: Fri, 20 Feb 2026 11:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E8=B7=B3=E8=BD=AC=E6=92=AD=E6=94=BE=E9=A1=B5=E7=BC=BA?= =?UTF-8?q?=E5=B0=91title=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/cron/[password]/route.ts | 2 +- src/components/NotificationPanel.tsx | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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(); } };