From ec8a8c4803bdc8d3512bddcd8dd262ac72ac7893 Mon Sep 17 00:00:00 2001 From: Gary Date: Fri, 15 Mar 2024 13:17:36 +0800 Subject: [PATCH] 1.update user info avatar to thumbnail --- .../java/com/luoo/user/controller/MyController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java index 014ef14..2c9067e 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MyController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MyController.java @@ -187,7 +187,7 @@ public class MyController extends BaseController { userInfoService.update(user); rabbitTemplate.convertAndSend("userInfoCommentCache",userLoginDto.getUserId()); - return Result.success(Constants.RESOURCE_PREFIX + avatarFilePath); + return Result.success(Constants.RESOURCE_PREFIX + user.getThumbnail()); } @ApiOperation(value = "4.查看他人信息", notes = "游客无法查看他人信息") @@ -327,7 +327,7 @@ public class MyController extends BaseController { userRespDTO.setBadgeList(new ArrayList<>(badgeSet)); } if (null != userRespDTO.getAvatar()) { - userRespDTO.setAvatar(Constants.RESOURCE_PREFIX + userRespDTO.getAvatar()); + userRespDTO.setAvatar(getAvatar(user)); } if (null != user.getBirthday()) { userRespDTO.setBirthDay( @@ -360,6 +360,13 @@ public class MyController extends BaseController { return userRespDTO; } + private String getAvatar(UserInfo user) { + if(StringTools.isEmpty(user.getThumbnail())) { + return Constants.RESOURCE_PREFIX + user.getAvatar(); + } + return Constants.RESOURCE_PREFIX + user.getThumbnail(); + } + // 查询我的获赞 @ApiOperation(value = "9.查询我的获赞的分页列表", notes = "游客无法获取") @GetMapping("/myThumbupList/{page}/{size}")