diff --git a/README.md b/README.md index 1eafae9..e5f1fa5 100644 --- a/README.md +++ b/README.md @@ -154,8 +154,6 @@ npx @cloudflare/next-on-pages 两个分支使用**完全相同的 `schema.sql`**,共用同一个数据库实例(已验证:main 的 Express 代码与 next 的 Next.js 代码可同时连接同一 PostgreSQL 库,表结构、数据互不冲突)。 -> 注意:上游 main 的 `server.js` 引用了 `is_pinned` / `signature` 等列,但这些列在上游仓库的 `schema.sql` 中缺失(未同步)。本分支的 `schema.sql` 是完整超集,已包含全部列,可直接用于两个分支。 - ## 🏗️ 项目结构 ``` diff --git a/app/api/auth/me/route.js b/app/api/auth/me/route.js index 44c6a72..b948cd3 100644 --- a/app/api/auth/me/route.js +++ b/app/api/auth/me/route.js @@ -9,7 +9,7 @@ export async function GET(req) { } try { const r = await pool.query( - 'SELECT id, username, avatar_url, bio, role, created_at FROM users WHERE id = $1', + 'SELECT id, username, avatar_url, bio, signature, role, created_at FROM users WHERE id = $1', [user.id] ); if (!r.rows[0]) { diff --git a/app/api/users/[id]/route.js b/app/api/users/[id]/route.js index 92897af..826c157 100644 --- a/app/api/users/[id]/route.js +++ b/app/api/users/[id]/route.js @@ -35,7 +35,7 @@ export async function PUT(req, { params }) { return Response.json({ error: '无权限修改他人资料' }, { status: 403 }); } try { - await pool.query('UPDATE users SET username = $1, bio = $2 WHERE id = $3', [username, bio || '', id]); + await pool.query('UPDATE users SET username = $1, bio = $2, signature = $3 WHERE id = $4', [username, bio || '', signature || '', id]); return Response.json({ success: true }); } catch (err) { if (err.code === '23505') { diff --git a/components/PostDetail.js b/components/PostDetail.js index e0644f4..f0fff46 100644 --- a/components/PostDetail.js +++ b/components/PostDetail.js @@ -140,6 +140,11 @@ export default function PostDetail({ postId }) { ))} )} + {post.signature && ( +