Compare commits
1 Commits
feature-Po
...
34663e8e84
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34663e8e84 |
@@ -147,3 +147,5 @@ public class SmsUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class PostController {
|
|||||||
private PostService postService;
|
private PostService postService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传媒体文件接口
|
* 上传媒体文件接口 like
|
||||||
* @param files 媒体文件数组
|
* @param files 媒体文件数组
|
||||||
* @return 上传后的文件URL列表
|
* @return 上传后的文件URL列表
|
||||||
*/
|
*/
|
||||||
@@ -33,13 +33,14 @@ public class PostController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布动态接口 - JSON格式请求
|
* 发布动态接口 - JSON格式请求
|
||||||
* @param postRequestDTO 动态信息
|
* @param postDTO 动态信息
|
||||||
|
* @param userId 用户ID
|
||||||
* @return 发布的动态对象
|
* @return 发布的动态对象
|
||||||
*/
|
*/
|
||||||
@PostMapping(consumes = "application/json")
|
@PostMapping(consumes = "application/json")
|
||||||
public Result<Post> createPostJson(@RequestBody PostRequestDTO postRequestDTO) {
|
public Result<Post> createPostJson(@RequestBody PostRequestDTO postDTO, @RequestParam Long userId) {
|
||||||
// 调用 Service 层处理发布动态业务逻辑
|
// 调用 Service 层处理发布动态业务逻辑
|
||||||
Post result = postService.createPost(postRequestDTO);
|
Post result = postService.createPost(userId, postDTO);
|
||||||
return Result.success(ResultCode.SUCCESS_REVIEW, "动态发布成功,等待审核。", result);
|
return Result.success(ResultCode.SUCCESS_REVIEW, "动态发布成功,等待审核。", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ public class PostController {
|
|||||||
* @return 删除结果
|
* @return 删除结果
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/{postId}")
|
@DeleteMapping("/{postId}")
|
||||||
public Result<String> deleteById(@PathVariable Integer postId){
|
public Result<String> deleteById(@PathVariable Long postId){
|
||||||
postService.deletePostById(postId);
|
postService.deletePostById(postId);
|
||||||
return Result.success(ResultCode.SUCCESS_DELETE, "动态删除成功", null);
|
return Result.success(ResultCode.SUCCESS_DELETE, "动态删除成功", null);
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ public class PostController {
|
|||||||
PostEditVO postEditVO = postService.getPostForEdit(postId);
|
PostEditVO postEditVO = postService.getPostForEdit(postId);
|
||||||
return Result.success(ResultCode.SUCCESS,"查询成功", postEditVO);
|
return Result.success(ResultCode.SUCCESS,"查询成功", postEditVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新动态接口
|
* 更新动态接口
|
||||||
* @param postId 动态ID
|
* @param postId 动态ID
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ public interface PostService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建动态
|
* 创建动态
|
||||||
*
|
* @param userId 用户ID
|
||||||
* @param postRequestDTO 动态数据传输对象
|
* @param postRequestDTO 动态数据传输对象
|
||||||
* @return 创建的动态对象
|
* @return 创建的动态对象
|
||||||
*/
|
*/
|
||||||
Post createPost(PostRequestDTO postRequestDTO);
|
Post createPost(Long userId, PostRequestDTO postRequestDTO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除动态
|
* 删除动态
|
||||||
|
|||||||
@@ -79,11 +79,12 @@ public class PostServiceImpl implements PostService {
|
|||||||
/**
|
/**
|
||||||
* 创建动态
|
* 创建动态
|
||||||
*
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
* @param postRequestDTO 动态数据传输对象
|
* @param postRequestDTO 动态数据传输对象
|
||||||
* @return 创建的动态对象
|
* @return 创建的动态对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Post createPost(PostRequestDTO postRequestDTO) {
|
public Post createPost(Long userId, PostRequestDTO postRequestDTO) {
|
||||||
|
|
||||||
// 创建动态对象
|
// 创建动态对象
|
||||||
Post post = new Post();
|
Post post = new Post();
|
||||||
|
|||||||
@@ -89,3 +89,5 @@ public class MD5Util {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ aliyun:
|
|||||||
secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
|
secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
|
||||||
scenes: antispam
|
scenes: antispam
|
||||||
# 阿里云短信服务配置
|
# 阿里云短信服务配置
|
||||||
# sms:
|
sms:
|
||||||
# access-key-id: LTAI5t5vpcbCZwweNHEDDDaF
|
access-key-id: LTAI5t5vpcbCZwweNHEDDDaF
|
||||||
# access-key-secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
|
access-key-secret: bBHBAPiCqGyVBHUv07348wsHXkKqrk
|
||||||
# region-id: cn-hangzhou
|
region-id: cn-hangzhou
|
||||||
# sign-name:
|
sign-name: 速通互联验证码
|
||||||
# template-code: SMS_123456789
|
template-code: 100001
|
||||||
|
|||||||
@@ -73,3 +73,5 @@ public class EmailAndSmsTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user