import { prisma } from "@//app/lib/prisma" import { notFound } from "next/navigation" import Link from "next/link" export const dynamic = "force-dynamic" export default async function NewsDetailPage({ params, }: { params: Promise<{ id: string }> }) { const { id } = await params const news = await prisma.news.findUnique({ where: { id: parseInt(id) }, }) if (!news || !news.published) { notFound() } return (
← 返回新闻列表
{news.type === "news" ? "新闻" : news.type} {new Date(news.createdAt).toLocaleDateString("zh-CN")}

{news.title}

{news.content}

发布于 {new Date(news.createdAt).toLocaleDateString("zh-CN")} 查看更多新闻 →
) }