前段
Change-Id: I718d4d07ea03c6d2b6bcbd4d426c5d1af2201bf4
diff --git a/src/api/helpPost.js b/src/api/helpPost.js
new file mode 100644
index 0000000..426e92b
--- /dev/null
+++ b/src/api/helpPost.js
@@ -0,0 +1,28 @@
+// src/api/helpPost.js
+import { api } from './auth'; // 复用已有的axios实例
+
+export const createPost = (title, content, authorId) => {
+ return api.post('/help/posts', {
+ title,
+ content,
+ authorId
+ });
+};
+
+export const getPosts = (page = 1, size = 5) => {
+ return api.get('/help/posts', {
+ params: { page, size }
+ });
+};
+
+export const getPostDetail = (postId) => {
+ return api.get(`/help/posts/${postId}`);
+};
+
+export const likePost = (postId) => {
+ return api.post(`/help/posts/${postId}/like`);
+};
+
+export const addPostComment = (postId, commentData) => {
+ return api.post(`/help/posts/${postId}/comments`, commentData);
+};
\ No newline at end of file