|
@@ -103,6 +103,28 @@ public class PostController {
|
|
|
return Response.ok();
|
|
return Response.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Operation(summary = "更新帖子(管理员)")
|
|
|
|
|
+ @PreAuthorize("hasRole('ROLE_admin')")
|
|
|
|
|
+ @PutMapping("{id}")
|
|
|
|
|
+ public Response<Void> updatePost(@PathVariable Long id, @Valid @RequestBody PostDto dto) {
|
|
|
|
|
+ Post post = new Post();
|
|
|
|
|
+ post.setTitle(dto.getTitle());
|
|
|
|
|
+ post.setContentIntro(dto.getContentIntro());
|
|
|
|
|
+ post.setContentPaid(dto.getContentPaid());
|
|
|
|
|
+ post.setPrice(dto.getPrice());
|
|
|
|
|
+ post.setExpireTime(dto.getExpireTime());
|
|
|
|
|
+ postService.updatePost(id, post);
|
|
|
|
|
+ return Response.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "删除帖子(管理员,逻辑删除)")
|
|
|
|
|
+ @PreAuthorize("hasRole('ROLE_admin')")
|
|
|
|
|
+ @DeleteMapping("{id}")
|
|
|
|
|
+ public Response<Void> deletePost(@PathVariable Long id) {
|
|
|
|
|
+ postService.deletePost(id);
|
|
|
|
|
+ return Response.ok();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Operation(summary = "获取专家往期帖子")
|
|
@Operation(summary = "获取专家往期帖子")
|
|
|
@GetMapping("expert/{expertId}/previous")
|
|
@GetMapping("expert/{expertId}/previous")
|
|
|
public Response<PageVo<List<PostVo>>> listPreviousPosts(
|
|
public Response<PageVo<List<PostVo>>> listPreviousPosts(
|