保存当前工作进度 - 2025-06-20 18:08:36
Change-Id: I9465ca3726869f7cd91fe381097d780fe7fc1271
diff --git a/Merge/back_jwlll/__pycache__/word2vec_helper.cpython-312.pyc b/Merge/back_jwlll/__pycache__/word2vec_helper.cpython-312.pyc
new file mode 100644
index 0000000..2be1048
--- /dev/null
+++ b/Merge/back_jwlll/__pycache__/word2vec_helper.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_rhj/app/user_post_graph.txt b/Merge/back_rhj/app/user_post_graph.txt
index 23da7af..f8ef7df 100644
--- a/Merge/back_rhj/app/user_post_graph.txt
+++ b/Merge/back_rhj/app/user_post_graph.txt
@@ -1,11 +1,12 @@
-0 0 0 1 1 0 1 0 41 31 61 51 11 21 1749827292 1749953091 1749953091 1749953480 1749953480 1749954059 1749954059 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1 1 2 2 1 2 1 5 2 2 1 5 1
-1 1 42 32 52 0 4 12 22 1749827292 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 5 1 5 2 2 5 1 2
-2 6 5 6 5 43 33 53 1 13 23 1749953091 1749953091 1749953480 1749953480 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 2 1 2 1 2 1 5 5 2 5
-3 2 2 0 44 34 54 14 24 1749953091 1749953480 1749954059 1749955282 1749955282 1749955282 1749955282 1749955282 2 2 2 5 2 1 5 1
-4 1 45 35 55 15 5 25 1749954059 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 5 1 5 2 1 5 2
-5 36 46 56 2 6 16 26 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1 2 5 5 1 2 5
-6 37 47 57 7 17 27 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 2 5 1 2 5 1
-7 38 48 58 3 8 18 28 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 5 1 2 2 5 1 2
-8 39 49 59 9 19 29 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 1 2 5 1 2 5
-9 40 50 60 10 30 20 1749955282 1749955282 1749955282 1749955282 1749955282 1749955282 2 5 1 2 1 5
+0 0 0 1 1 0 1 0 11 1749827292 1749953091 1749953091 1749953480 1749953480 1749954059 1749954059 1749955282 1 1 2 2 1 2 1 5
+1 1 4 0 12 1749827292 1749955282 1749955282 1749955282 5 5 2 1
+2 6 5 6 5 13 1 0 0 1 1 2 1749953091 1749953091 1749953480 1749953480 1749955282 1749955282 1750372189 1750372215 1750372231 1750372241 1750372258 2 1 2 1 2 5 3 2 3 2 2
+3 2 2 0 1749953091 1749953480 1749954059 2 2 2
+4 1 5 1749954059 1749955282 5 5
+5 2 6 1749955282 1749955282 5 1
+6 7 1749955282 2
+7 3 8 1749955282 1749955282 2 5
+8 9 1749955282 1
+9 10 1749955282 2
10 12 1749894174 5
+11 1 4 7 0 2 13 4 11 1750372862 1750372873 1750373008 1750373592 1750373596 1750374164 1750374867 1750374871 3 3 3 2 2 2 2 2
diff --git a/Merge/back_trm/__pycache__/config.cpython-312.pyc b/Merge/back_trm/__pycache__/config.cpython-312.pyc
new file mode 100644
index 0000000..72018e2
--- /dev/null
+++ b/Merge/back_trm/__pycache__/config.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/__pycache__/__init__.cpython-312.pyc b/Merge/back_trm/app/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..10ec6ee
--- /dev/null
+++ b/Merge/back_trm/app/__pycache__/__init__.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/__pycache__/routes.cpython-312.pyc b/Merge/back_trm/app/__pycache__/routes.cpython-312.pyc
new file mode 100644
index 0000000..5e75b26
--- /dev/null
+++ b/Merge/back_trm/app/__pycache__/routes.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/functions/__pycache__/Fpost.cpython-312.pyc b/Merge/back_trm/app/functions/__pycache__/Fpost.cpython-312.pyc
new file mode 100644
index 0000000..dd9391d
--- /dev/null
+++ b/Merge/back_trm/app/functions/__pycache__/Fpost.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/functions/__pycache__/__init__.cpython-312.pyc b/Merge/back_trm/app/functions/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..8e3382e
--- /dev/null
+++ b/Merge/back_trm/app/functions/__pycache__/__init__.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/__init__.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..fdafc61
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/__init__.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/logs.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/logs.cpython-312.pyc
new file mode 100644
index 0000000..a9846f5
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/logs.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/post.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/post.cpython-312.pyc
new file mode 100644
index 0000000..c7516cc
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/post.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/syscost.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/syscost.cpython-312.pyc
new file mode 100644
index 0000000..bb81dd0
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/syscost.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/topics.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/topics.cpython-312.pyc
new file mode 100644
index 0000000..658c0cd
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/topics.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_trm/app/models/__pycache__/users.cpython-312.pyc b/Merge/back_trm/app/models/__pycache__/users.cpython-312.pyc
new file mode 100644
index 0000000..afa2197
--- /dev/null
+++ b/Merge/back_trm/app/models/__pycache__/users.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_wzy/models/__pycache__/logs.cpython-312.pyc b/Merge/back_wzy/models/__pycache__/logs.cpython-312.pyc
new file mode 100644
index 0000000..2f17c9c
--- /dev/null
+++ b/Merge/back_wzy/models/__pycache__/logs.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_wzy/models/__pycache__/syscost.cpython-312.pyc b/Merge/back_wzy/models/__pycache__/syscost.cpython-312.pyc
new file mode 100644
index 0000000..19df843
--- /dev/null
+++ b/Merge/back_wzy/models/__pycache__/syscost.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_wzy/routes/__pycache__/posts.cpython-312.pyc b/Merge/back_wzy/routes/__pycache__/posts.cpython-312.pyc
index 1787ef1..729675c 100644
--- a/Merge/back_wzy/routes/__pycache__/posts.cpython-312.pyc
+++ b/Merge/back_wzy/routes/__pycache__/posts.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_wzy/utils/__pycache__/Fpost.cpython-312.pyc b/Merge/back_wzy/utils/__pycache__/Fpost.cpython-312.pyc
new file mode 100644
index 0000000..c0d1153
--- /dev/null
+++ b/Merge/back_wzy/utils/__pycache__/Fpost.cpython-312.pyc
Binary files differ
diff --git a/Merge/back_wzy/utils/__pycache__/__init__.cpython-312.pyc b/Merge/back_wzy/utils/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..da13bfc
--- /dev/null
+++ b/Merge/back_wzy/utils/__pycache__/__init__.cpython-312.pyc
Binary files differ
diff --git a/Merge/front/src/api/README.md b/Merge/front/src/api/README.md
new file mode 100644
index 0000000..567d772
--- /dev/null
+++ b/Merge/front/src/api/README.md
@@ -0,0 +1,109 @@
+# API 服务修改说明
+
+## 修改概述
+
+根据要求,仅首页的推荐和搜索功能使用 `back_jwlll` 服务,其他功能使用已有的其他后端服务。
+
+## 服务分工
+
+### JWLLL 服务 (端口 5000)
+**仅用于首页推荐和搜索功能**
+- 搜索内容 (`/search`)
+- 获取用户标签 (`/user_tags`)
+- 标签推荐 (`/recommend_tags`)
+- 协同过滤推荐 (`/user_based_recommend`)
+
+### WZY 服务 (端口 5714)
+**用于帖子相关功能**
+- 帖子详情查看 (`/posts/{id}`)
+- 帖子创建/更新/删除 (`/posts`)
+- 点赞功能 (`/posts/{id}/like`)
+- 评论功能 (`/posts/{id}/comments`)
+
+### LJC 服务 (端口 5715)
+**用于用户相关功能**
+- 用户信息管理 (`/api/user/{id}`)
+- 关注功能 (`/api/follow/{id}`)
+- 收藏功能 (`/api/user/{id}/favorites`)
+
+### TRM 服务 (端口 5713)
+**用于审核相关功能**
+- 帖子审核 (`/areview`)
+- 管理员功能 (`/apostlist`)
+
+## 修改的文件
+
+### 1. `/src/api/search_jwlll.js`
+- **修改内容**: 重构API调用,推荐搜索功能继续使用JWLLL服务,其他功能重定向到相应服务
+- **主要变更**:
+ - 搜索和推荐API仍使用 `http://127.0.0.1:5000`
+ - 帖子详情、点赞、评论、上传功能改用 WZY 服务 `http://10.126.59.25:5714`
+ - 添加数据格式适配逻辑
+
+### 2. `/src/api/posts_api.js` (新增)
+- **作用**: 提供统一的帖子相关API接口
+- **功能**: 整合不同后端服务的帖子和用户功能
+
+## 数据格式适配
+
+### 评论数据适配
+- **WZY服务返回**: `{id, user_id, content, created_at, replies}`
+- **前端期望**: `{id, user_name, content, create_time}`
+- **适配方案**: 在 `getComments` 方法中进行字段映射
+
+### 帖子上传适配
+- **前端数据**: `{title, content, tags, category, type, media_files}`
+- **WZY服务期望**: `{title, content, type, media_urls, status}`
+- **适配方案**: 在 `uploadPost` 方法中进行数据转换
+
+## 影响的组件
+
+### 自动适配的组件
+- `HomeFeed.jsx` - 推荐和搜索功能,继续使用JWLLL服务
+- `PostDetailJWLLL.jsx` - 帖子详情、点赞、评论功能,自动切换到WZY服务
+- `UploadPageJWLLL.jsx` - 帖子上传功能,自动切换到WZY服务
+
+### 使用新API的组件
+如需要,其他组件可以导入 `posts_api.js` 来使用统一的帖子和用户API。
+
+## 注意事项
+
+1. **标签功能限制**: WZY服务暂不完全支持标签功能,上传帖子时标签信息会被忽略
+2. **用户名显示**: 评论中的用户名使用 `用户{user_id}` 格式生成
+3. **服务兼容性**: 确保所有后端服务都正常运行且端口配置正确
+4. **错误处理**: 各服务的错误响应格式可能不同,前端已添加通用错误处理
+
+## 测试建议
+
+### 测试文件
+提供了 `test_api.js` 文件来验证API服务分工是否正确:
+
+```javascript
+import { runAllTests } from './test_api.js'
+
+// 运行所有测试
+runAllTests()
+```
+
+### 手动测试步骤
+1. **首页搜索测试**
+ - 在首页搜索框输入关键词
+ - 验证搜索结果来自 JWLLL 服务
+ - 测试推荐功能是否正常
+
+2. **帖子详情测试**
+ - 点击帖子进入详情页
+ - 验证帖子数据来自 WZY 服务
+ - 测试点赞、评论功能
+
+3. **帖子上传测试**
+ - 使用上传页面发布新帖子
+ - 验证上传请求发送到 WZY 服务
+ - 确认数据格式转换正确
+
+### 服务状态检查
+确保以下服务正常运行:
+- JWLLL 服务: `curl http://127.0.0.1:5000/word2vec_status`
+- WZY 服务: `curl http://10.126.59.25:5714/posts`
+- LJC 服务: `curl http://10.126.59.25:5715/api/current-user`
+- TRM 服务: `curl http://10.126.59.25:5713/health` (如果有)
diff --git a/Merge/front/src/api/posts_api.js b/Merge/front/src/api/posts_api.js
new file mode 100644
index 0000000..a336da0
--- /dev/null
+++ b/Merge/front/src/api/posts_api.js
@@ -0,0 +1,136 @@
+// 帖子相关API接口
+// 整合不同后端服务的帖子功能
+
+// WZY 后端服务 - 帖子CRUD、点赞、评论
+const WZY_BASE_URL = 'http://10.126.59.25:5714'
+// LJC 后端服务 - 用户相关功能
+const LJC_BASE_URL = 'http://10.126.59.25:5715'
+
+// 通用请求函数
+const request = async (url, options = {}) => {
+ try {
+ const response = await fetch(url, {
+ headers: {
+ 'Content-Type': 'application/json',
+ ...options.headers
+ },
+ ...options
+ })
+ return await response.json()
+ } catch (error) {
+ console.error('API请求错误:', error)
+ throw error
+ }
+}
+
+// 帖子相关API
+export const postsAPI = {
+ // ===== 帖子基础功能 - 使用 WZY 服务 =====
+
+ // 获取帖子列表
+ fetchPosts: async (userId = null) => {
+ const url = userId ? `${WZY_BASE_URL}/posts?user_id=${userId}` : `${WZY_BASE_URL}/posts`
+ return await request(url)
+ },
+
+ // 获取帖子详情
+ fetchPost: async (postId) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}`)
+ },
+
+ // 创建帖子
+ createPost: async (postData) => {
+ return await request(`${WZY_BASE_URL}/posts`, {
+ method: 'POST',
+ body: JSON.stringify(postData)
+ })
+ },
+
+ // 更新帖子
+ updatePost: async (postId, postData) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}`, {
+ method: 'PUT',
+ body: JSON.stringify(postData)
+ })
+ },
+
+ // 删除帖子
+ deletePost: async (postId) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}`, {
+ method: 'DELETE'
+ })
+ },
+
+ // ===== 互动功能 - 使用 WZY 服务 =====
+
+ // 点赞帖子
+ likePost: async (postId, userId) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}/like`, {
+ method: 'POST',
+ body: JSON.stringify({ user_id: userId })
+ })
+ },
+
+ // 取消点赞
+ unlikePost: async (postId, userId) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}/like`, {
+ method: 'DELETE',
+ body: JSON.stringify({ user_id: userId })
+ })
+ },
+
+ // 添加评论
+ addComment: async (postId, userId, content, parentId = null) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}/comments`, {
+ method: 'POST',
+ body: JSON.stringify({
+ user_id: userId,
+ content,
+ parent_id: parentId
+ })
+ })
+ },
+
+ // 获取评论列表
+ fetchComments: async (postId) => {
+ return await request(`${WZY_BASE_URL}/posts/${postId}/comments`)
+ },
+
+ // ===== 用户相关功能 - 使用 LJC 服务 =====
+
+ // 获取用户信息
+ getCurrentUser: async () => {
+ return await request(`${LJC_BASE_URL}/api/current-user`)
+ },
+
+ // 获取用户详情
+ getUser: async (userId) => {
+ return await request(`${LJC_BASE_URL}/api/user/${userId}`)
+ },
+
+ // 获取用户帖子
+ getUserPosts: async (userId) => {
+ return await request(`${LJC_BASE_URL}/api/user/${userId}/posts`)
+ },
+
+ // 关注用户
+ followUser: async (followeeId) => {
+ return await request(`${LJC_BASE_URL}/api/follow/${followeeId}`, {
+ method: 'POST'
+ })
+ },
+
+ // 取消关注
+ unfollowUser: async (followeeId) => {
+ return await request(`${LJC_BASE_URL}/api/follow/${followeeId}`, {
+ method: 'DELETE'
+ })
+ },
+
+ // 获取收藏列表
+ getFavorites: async (userId) => {
+ return await request(`${LJC_BASE_URL}/api/user/${userId}/favorites`)
+ }
+}
+
+export default postsAPI
diff --git a/Merge/front/src/utils/test_user_id.js b/Merge/front/src/utils/test_user_id.js
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Merge/front/src/utils/test_user_id.js
diff --git "a/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\207\346\241\243.pdf" "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\207\346\241\243.pdf"
new file mode 100644
index 0000000..66ffcb9
--- /dev/null
+++ "b/\346\216\245\345\217\243\350\257\264\346\230\216\346\226\207\346\241\243.pdf"
Binary files differ