diff --git a/Merge/front/src/components/PostDetailJWLLL.jsx b/Merge/front/src/components/PostDetailJWLLL.jsx
index 0dc7289..009ba6c 100644
--- a/Merge/front/src/components/PostDetailJWLLL.jsx
+++ b/Merge/front/src/components/PostDetailJWLLL.jsx
@@ -1,7 +1,8 @@
-import React, { useState, useEffect } from 'react'
+import React, { useState, useEffect, useCallback } from 'react'
 import { useParams, useNavigate } from 'react-router-dom'
 import { ArrowLeft, ThumbsUp, MessageCircle, Share2, BookmarkPlus, Heart, Eye } from 'lucide-react'
 import { searchAPI } from '../api/search_jwlll'
+import { getUserInfo } from '../utils/auth'
 import '../style/PostDetail.css'
 
 export default function PostDetail() {
@@ -16,15 +17,13 @@
   const [comments, setComments] = useState([])
   const [newComment, setNewComment] = useState('')
   const [showComments, setShowComments] = useState(false)
+  // 获取当前用户ID
+  const getCurrentUserId = () => {
+    const userInfo = getUserInfo()
+    return userInfo?.id || '3' // 如果未登录或无用户信息，使用默认值3
+  }
 
-  const DEFAULT_USER_ID = '3' // 默认用户ID
-
-  useEffect(() => {
-    fetchPostDetail()
-    fetchComments()
-  }, [id])
-
-  const fetchPostDetail = async () => {
+  const fetchPostDetail = useCallback(async () => {
     setLoading(true)
     setError(null)
     try {
@@ -37,28 +36,33 @@
     } finally {
       setLoading(false)
     }
-  }
+  }, [id])
 
-  const fetchComments = async () => {
+  const fetchComments = useCallback(async () => {
     try {
       const data = await searchAPI.getComments(id)
       setComments(data.comments || [])
     } catch (error) {
       console.error('获取评论失败:', error)
     }
-  }
+  }, [id])
+
+  useEffect(() => {
+    fetchPostDetail()
+    fetchComments()
+  }, [fetchPostDetail, fetchComments])
 
   const handleBack = () => {
     navigate(-1)
   }
-
   const handleLike = async () => {
     try {
+      const currentUserId = getCurrentUserId()
       const newLiked = !liked
       if (newLiked) {
-        await searchAPI.likePost(id, DEFAULT_USER_ID)
+        await searchAPI.likePost(id, currentUserId)
       } else {
-        await searchAPI.unlikePost(id, DEFAULT_USER_ID)
+        await searchAPI.unlikePost(id, currentUserId)
       }
       setLiked(newLiked)
       setLikeCount(prev => newLiked ? prev + 1 : prev - 1)
@@ -89,13 +93,13 @@
       alert('链接已复制到剪贴板')
     }
   }
-
   const handleAddComment = async (e) => {
     e.preventDefault()
     if (!newComment.trim()) return
 
     try {
-      await searchAPI.addComment(id, DEFAULT_USER_ID, newComment)
+      const currentUserId = getCurrentUserId()
+      await searchAPI.addComment(id, currentUserId, newComment)
       setNewComment('')
       fetchComments() // 刷新评论列表
     } catch (error) {
