diff --git a/src/services/articleService.js b/src/services/articleService.js index 9c29cb9..60bc21e 100644 --- a/src/services/articleService.js +++ b/src/services/articleService.js @@ -16,15 +16,7 @@ class ArticleService { getPagedArticles(params = {}) { return api.get(`/articles/status/page?title=${params.title || ''}&categoryid=${params.categoryid || 0}&attributeid=${params.attributeid || 0}&status=${params.status || 1}&page=${params.page || 0}&size=${params.size || 10}`) } - /** - * 获取分页文章数量 - * @param {number} status - 文章状态(0:未发表 1:已发表 2:已删除) - * @returns {Promise>} - */ - getArticleCountByStatus(status) { - return api.get(`/articles/count/status/${status || 1}`) - } - /** +/** * 获取已发布文章列表 * @param {import('../types').PaginationParams} params - 查询参数 * @returns {Promise>} @@ -32,15 +24,7 @@ class ArticleService { getAllArticles(params = {}) { return api.get('/articles/published', { params }) } - /** - * 根据状态获取文章列表 - * @param {number} status - 文章状态(0:未发表 1:已发表 2:已删除) - * @returns {Promise>} - */ - getArticlesByStatus(status) { - return api.get(`/articles/status/${status}`) - } - /** +/** * 获取所有文章列表(包含已删除) * @param {import('../types').PaginationParams} params - 查询参数 * @returns {Promise>} @@ -48,16 +32,7 @@ class ArticleService { getAllArticlesWithDeleted(params = {}) { return api.get('/articles', { params }) } - /** - * 根据ID获取文章详情 - * @param {number} articleid - 文章ID - * @returns {Promise>} - */ - getArticleById(articleid) { - return api.get(`/articles/${articleid}`) - } - - /** +/** * 根据属性ID获取文章列表 * @param {number} attributeid - 属性ID * @returns {Promise>} @@ -66,16 +41,7 @@ class ArticleService { return api.get(`/articles/attribute/${attributeid}`) } - /** - * 根据标题查询文章列表 - * @param {string} title - 文章标题 - * @returns {Promise>} - */ - getArticlesByTitle(title) { - return api.get(`/articles/title/${title}`) - } - - /** +/** * 获取热门文章 * @returns {Promise>} */ @@ -111,16 +77,7 @@ class ArticleService { return api.delete(`/articles/${articleid}`) } - /** - * 根据分类获取文章 - * @param {number} categoryid - 分类ID - * @returns {Promise>} - */ - getArticlesByCategory(categoryid) { - return api.get(`/articles/category/${categoryid}`) - } - - /** +/** * 增加文章浏览量 * @param {number} articleid - 文章ID * @returns {Promise>} @@ -129,23 +86,7 @@ class ArticleService { return api.post(`/articles/view/${articleid}`) } - /** - * 根据属性ID获取最新文章 - * @param {number} attributeid - 属性ID - * @returns {Promise>} - */ - getLatestArticlesByAttribute(attributeid) { - return api.get(`/articles/attribute/${attributeid}/latest`) - } - /** - * 点赞文章 - * @param {number} articleid - 文章ID - * @returns {Promise>} - */ - likeArticle(articleid) { - return api.post(`/articles/like/${articleid}`) - } } // 创建并导出服务实例 diff --git a/src/services/categoryAttributeService.js b/src/services/categoryAttributeService.js index 563dac3..c91ca62 100644 --- a/src/services/categoryAttributeService.js +++ b/src/services/categoryAttributeService.js @@ -39,35 +39,6 @@ class CategoryAttributeService { createAttribute(attributeData) { return api.post('/category-attributes', attributeData) } - - /** - * 更新分类属性 - * @param {number} attributeid - 属性ID - * @param {import('../types').CategoryAttributeDto} attributeData - 属性数据 - * @returns {Promise>} - */ - updateAttribute(attributeid, attributeData) { - return api.put(`/category-attributes/${attributeid}`, attributeData) - } - - /** - * 删除分类属性 - * @param {number} attributeid - 属性ID - * @returns {Promise>} - */ - deleteAttribute(attributeid) { - return api.delete(`/category-attributes/${attributeid}`) - } - - /** - * 检查分类下是否存在指定名称的属性 - * @param {number} categoryid - 分类ID - * @param {string} attributename - 属性名称 - * @returns {Promise>} - */ - checkAttributeExists(categoryid, attributename) { - return api.get(`/category-attributes/check-exists?categoryid=${categoryid}&attributename=${encodeURIComponent(attributename)}`) - } } // 创建并导出服务实例 diff --git a/src/services/categoryService.js b/src/services/categoryService.js index b4af456..e66384f 100644 --- a/src/services/categoryService.js +++ b/src/services/categoryService.js @@ -11,43 +11,6 @@ class CategoryService { getAllCategories() { return api.get('/categories') } - - /** - * 获取指定分类 - * @param {number} Categoryid - 分类ID - * @returns {Promise>} - */ - getCategory(Categoryid) { - return api.get(`/categories/${Categoryid}`) - } - - /** - * 创建新分类 - * @param {import('../types').CategoryDto} categoryData - 分类数据 - * @returns {Promise>} - */ - createCategory(categoryData) { - return api.post('/categories', categoryData) - } - - /** - * 更新分类 - * @param {number} Categoryid - 分类ID - * @param {import('../types').CategoryDto} categoryData - 分类数据 - * @returns {Promise>} - */ - updateCategory(Categoryid, categoryData) { - return api.put(`/categories/${Categoryid}`, categoryData) - } - - /** - * 删除分类 - * @param {number} Categoryid - 分类ID - * @returns {Promise>} - */ - deleteCategory(Categoryid) { - return api.delete(`/categories/${Categoryid}`) - } } // 创建并导出服务实例 diff --git a/src/services/loginService.js b/src/services/loginService.js index 143f149..43b3be8 100644 --- a/src/services/loginService.js +++ b/src/services/loginService.js @@ -14,48 +14,11 @@ class LoginService { return api.post("/auth/login", loginData); } - /** - * 用户注册 - * @param {import('../types').RegisterDto} registerData - 注册数据 - * @returns {Promise>} - */ - register(registerData) { - return api.post("/auth/register", registerData); - } - /** * 登出 */ logout() { - return api.post("/auth/logout"); - - } - - /** - * 获取当前用户信息 - * @returns {Promise>} - */ - getCurrentUser() { - return api.get("/user/info"); - } - - /** - * 更新用户信息 - * @param {import('../types').UserDto} userData - 用户数据 - * @returns {Promise>} - */ - updateUser(userData) { - return api.put("/user/update", userData); - } - - /** - * 修改密码 - * @param {import('../types').ChangePasswordDto} passwordData - 密码数据 - * @returns {Promise>} - */ - changePassword(passwordData) { - return api.post("/user/change-password", passwordData); } } export default new LoginService(); \ No newline at end of file diff --git a/src/services/messageService.js b/src/services/messageService.js index 50ea6ea..a514fa9 100644 --- a/src/services/messageService.js +++ b/src/services/messageService.js @@ -5,23 +5,6 @@ import apiService from './apiService' * 留言服务类 */ class MessageService { - /** - * 获取所有留言 - * @returns {Promise>} - */ - getAllMessages() { - return apiService.get('/messages') - } - - /** - * 获取单条留言 - * @param {number} messageid - 留言ID - * @returns {Promise>} - */ - getMessageById(messageid) { - return apiService.get(`/messages/${messageid}`) - } - /** * 获取留言数量 * @param {number} articleid - 文章ID @@ -55,29 +38,11 @@ class MessageService { } /** - * 获取根留言 + * 获取所有留言 * @returns {Promise>} */ - getRootMessages() { - return apiService.get('/messages/root') - } - - /** - * 根据父留言ID获取回复 - * @param {number} parentid - 父留言ID - * @returns {Promise>} - */ - getRepliesByParentId(parentid) { - return apiService.get(`/messages/${parentid}/replies`) - } - - /** - * 根据昵称搜索留言 - * @param {string} nickname - 昵称 - * @returns {Promise>} - */ - searchMessagesByNickname(nickname) { - return apiService.get(`/messages/search?nickname=${nickname}`) + getAllMessages() { + return apiService.get('/messages') } /** @@ -102,7 +67,6 @@ class MessageService { * 点赞留言 * @param {number} messageid - 留言ID * @returns {Promise>} - * */ likeMessage(messageid) { return apiService.post(`/messages/${messageid}/like`)