Bladeren bron

修改@LoginAppUser注解为代码获取登录用户

Alex 4 jaren geleden
bovenliggende
commit
d498d3254f

+ 2 - 1
ruoyi-app/src/main/java/com/ruoyi/app/controller/FamilyController.java

@@ -223,10 +223,11 @@ public class FamilyController extends AppBaseController {
     @ApiOperation("退出家族")
     @ApiImplicitParam(name = "familyId", value = "申请的家族ID",paramType="Long")
     @GetMapping("/quit")
-    public AjaxResult quit(@LoginAppUser AppMemberVo user, Long familyId) {
+    public AjaxResult quit(Long familyId) {
         if (familyId == null) {
             return AjaxResult.error("家族id为空");
         }
+        AppMemberVo user = getLoginUser().getUser();
         TbMemberMiddle middle = middleService.getOne(new LambdaQueryWrapper<TbMemberMiddle>()
                 .eq(TbMemberMiddle::getMemberId,user.getMemberId())
                 .eq(TbMemberMiddle::getFamilyId,familyId)

+ 2 - 1
ruoyi-app/src/main/java/com/ruoyi/app/controller/MyProfileController.java

@@ -48,13 +48,14 @@ public class MyProfileController extends AppBaseController {
 
     @ApiOperation("添加/修改个人详情")
     @PostMapping("/saveOrUpdate")
-    public AjaxResult saveOrUpdate(@LoginAppUser AppMemberVo user,@RequestBody TbMyProfile profile) {
+    public AjaxResult saveOrUpdate(@RequestBody TbMyProfile profile) {
         if (StringUtils.isBlank(profile.getTitle()) || StringUtils.isBlank(profile.getCotents())) {
             return AjaxResult.error("标题或内容不能为空");
         }
         if (profile.getAppUserId() == null) {
             return AjaxResult.error("参数异常");
         }
+        AppMemberVo user = getLoginUser().getUser();
         Date date = new Date();
         //新增
         if (profile.getId() == null) {

+ 2 - 1
ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishCommentController.java

@@ -39,13 +39,14 @@ public class PublishCommentController extends AppBaseController {
      */
     @ApiOperation("添加评论")
     @GetMapping("/add")
-    public AjaxResult addComment(@LoginAppUser AppMemberVo user, TbPublishComment comment) {
+    public AjaxResult addComment(TbPublishComment comment) {
         if (comment.getPublishId() == null || comment.getAppUserId() == null) {
             return AjaxResult.error("参数为空");
         }
         if (StringUtils.isBlank(comment.getContents())){
             return AjaxResult.error("评论内容不能为空");
         }
+        AppMemberVo user = getLoginUser().getUser();
         comment.setCreateBy(user.getUserId().toString());
         comment.setCreateTime(new Date());
         if (commentService.save(comment)){

+ 2 - 1
ruoyi-app/src/main/java/com/ruoyi/app/controller/PublishThumbsController.java

@@ -49,7 +49,7 @@ public class PublishThumbsController extends AppBaseController {
             @ApiImplicitParam(name = "publishId", value = "发表id",paramType="Long")
     })
     @GetMapping("/action")
-    public AjaxResult action(@LoginAppUser AppMemberVo user, Long appUserId, Long publishId){
+    public AjaxResult action(Long appUserId, Long publishId){
         // TODO 在点赞或取消时,APP端的点赞数组异步增加或去掉记录
         if (appUserId == null || publishId == null) {
             return AjaxResult.error("参数不能为空");
@@ -59,6 +59,7 @@ public class PublishThumbsController extends AppBaseController {
                 .eq(TbPublishThumbs::getAppUserId,appUserId)
                 .last("limit 1")
         );
+        AppMemberVo user = getLoginUser().getUser();
         Date date = new Date();
         // 点赞
         if (thumbs == null) {