1 Commits

Author SHA1 Message Date
KilLze
34663e8e84 整合 2025-12-25 18:23:04 +08:00
7 changed files with 23 additions and 15 deletions

View File

@@ -147,3 +147,5 @@ public class SmsUtil {
}
}

View File

@@ -21,7 +21,7 @@ public class PostController {
private PostService postService;
/**
* 上传媒体文件接口
* 上传媒体文件接口 like
* @param files 媒体文件数组
* @return 上传后的文件URL列表
*/
@@ -33,13 +33,14 @@ public class PostController {
/**
* 发布动态接口 - JSON格式请求
* @param postRequestDTO 动态信息
* @param postDTO 动态信息
* @param userId 用户ID
* @return 发布的动态对象
*/
@PostMapping(consumes = "application/json")
public Result<Post> createPostJson(@RequestBody PostRequestDTO postRequestDTO) {
public Result<Post> createPostJson(@RequestBody PostRequestDTO postDTO, @RequestParam Long userId) {
// 调用 Service 层处理发布动态业务逻辑
Post result = postService.createPost(postRequestDTO);
Post result = postService.createPost(userId, postDTO);
return Result.success(ResultCode.SUCCESS_REVIEW, "动态发布成功,等待审核。", result);
}
@@ -50,7 +51,7 @@ public class PostController {
* @return 删除结果
*/
@DeleteMapping("/{postId}")
public Result<String> deleteById(@PathVariable Integer postId){
public Result<String> deleteById(@PathVariable Long postId){
postService.deletePostById(postId);
return Result.success(ResultCode.SUCCESS_DELETE, "动态删除成功", null);
}
@@ -65,7 +66,7 @@ public class PostController {
PostEditVO postEditVO = postService.getPostForEdit(postId);
return Result.success(ResultCode.SUCCESS,"查询成功", postEditVO);
}
/**
* 更新动态接口
* @param postId 动态ID

View File

@@ -17,11 +17,11 @@ public interface PostService {
/**
* 创建动态
*
* @param userId 用户ID
* @param postRequestDTO 动态数据传输对象
* @return 创建的动态对象
*/
Post createPost(PostRequestDTO postRequestDTO);
Post createPost(Long userId, PostRequestDTO postRequestDTO);
/**
* 删除动态

View File

@@ -79,11 +79,12 @@ public class PostServiceImpl implements PostService {
/**
* 创建动态
*
* @param userId 用户ID
* @param postRequestDTO 动态数据传输对象
* @return 创建的动态对象
*/
@Override
public Post createPost(PostRequestDTO postRequestDTO) {
public Post createPost(Long userId, PostRequestDTO postRequestDTO) {
// 创建动态对象
Post post = new Post();

View File

@@ -89,3 +89,5 @@ public class MD5Util {
}
}

View File

@@ -46,9 +46,9 @@ aliyun:
secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
scenes: antispam
# 阿里云短信服务配置
# sms:
# access-key-id: LTAI5t5vpcbCZwweNHEDDDaF
# access-key-secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
# region-id: cn-hangzhou
# sign-name:
# template-code: SMS_123456789
sms:
access-key-id: LTAI5t5vpcbCZwweNHEDDDaF
access-key-secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
region-id: cn-hangzhou
sign-name: 速通互联验证码
template-code: 100001

View File

@@ -73,3 +73,5 @@ public class EmailAndSmsTest {
}