Oss上传文件(有bug)
This commit is contained in:
@@ -7,6 +7,7 @@ import com.bao.dating.pojo.entity.Post;
|
||||
import com.bao.dating.service.PostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/posts")
|
||||
@@ -16,9 +17,9 @@ public class PostController {
|
||||
private PostService postService;
|
||||
|
||||
@PostMapping
|
||||
public Result<Post> createPost(Post post) {
|
||||
public Result<Post> createPost(@RequestBody Post post, MultipartFile file) {
|
||||
// 调用 Service 层处理发布动态业务逻辑
|
||||
Post result = postService.createPost(post);
|
||||
return Result.success(ResultCode.SUCCESS_REVIEW,"动态发布成功,等待审核。",result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user