Oss上传文件(有bug)

This commit is contained in:
KilLze
2025-12-18 18:51:26 +08:00
parent 347c56dd40
commit 9e8d35d5b3
7 changed files with 25 additions and 14 deletions

View File

@@ -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);
}
}
}