修bug,顺便修改接口名

This commit is contained in:
KilLze
2025-12-28 18:05:47 +08:00
parent 7abd6fe27d
commit 2cb8ae5c3c

View File

@@ -36,7 +36,7 @@ public class PostController {
* @param postDTO 动态信息 * @param postDTO 动态信息
* @return 发布的动态对象 * @return 发布的动态对象
*/ */
@PostMapping( "/addPost") @PostMapping( "/createPost")
public Result<Post> createPostJson(@RequestBody PostRequestDTO postDTO) { public Result<Post> createPostJson(@RequestBody PostRequestDTO postDTO) {
// 调用 Service 层处理发布动态业务逻辑 // 调用 Service 层处理发布动态业务逻辑
Post result = postService.createPost(postDTO); Post result = postService.createPost(postDTO);
@@ -50,7 +50,7 @@ public class PostController {
* @return 删除结果 * @return 删除结果
*/ */
@PostMapping("/deletePost") @PostMapping("/deletePost")
public Result<String> deleteById(@RequestParam List<Long> postIds){ public Result<String> deleteById(@RequestBody List<Long> postIds){
int deletedCount = postService.deletePostById(postIds); int deletedCount = postService.deletePostById(postIds);
return Result.success(ResultCode.SUCCESS_DELETE, deletedCount > 0 ? "成功删除" : "删除失败,该动态不存在", null); return Result.success(ResultCode.SUCCESS_DELETE, deletedCount > 0 ? "成功删除" : "删除失败,该动态不存在", null);
} }