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

@@ -24,6 +24,11 @@ public class PostServiceImpl implements PostService {
@Override
public Post createPost(Post post) {
// 检查并确保userId不为空如果为空则设置默认值
if (post.getUserId() == null) {
post.setUserId(1); // 设置默认用户ID为1
}
// 处理图片和视频上传到 OSS
List<String> mediaOssKeys = new ArrayList<>();
@@ -62,4 +67,4 @@ public class PostServiceImpl implements PostService {
postMapper.insert(post);
return post;
}
}
}