From 19bdb532425a009f378f2d4bc574808812bd9af2 Mon Sep 17 00:00:00 2001 From: chen-xin-zhi <3588068430@qq.com> Date: Mon, 17 Mar 2025 09:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cultural/heritage/controller/user/UserController.java | 4 ++++ src/main/java/com/cultural/heritage/utils/DecoderUtils.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/cultural/heritage/controller/user/UserController.java b/src/main/java/com/cultural/heritage/controller/user/UserController.java index 846f0c7..cd6aaa5 100644 --- a/src/main/java/com/cultural/heritage/controller/user/UserController.java +++ b/src/main/java/com/cultural/heritage/controller/user/UserController.java @@ -148,6 +148,8 @@ public class UserController { @Operation(summary = "小程序端用户获取登录信息", description = "参数:无,权限:所有人, 方法名:getLoginUser") public BaseResponse getLoginUser(HttpServletRequest request) { User user = userService.getLoginUser(request); + // TODO + user.setUserAvatar(FileConstant.SERVER_HOST + user.getUserAvatar()); return ResultUtils.success(userService.getUserVO(user)); } @@ -162,6 +164,8 @@ public class UserController { @AuthCheck(mustRole = UserConstant.ADMIN_ROLE) public BaseResponse getWebLoginUser(HttpServletRequest request) { User user = userService.getLoginUser(request); + // TODO + user.setUserAvatar(FileConstant.SERVER_HOST + user.getUserAvatar()); return ResultUtils.success(user); } diff --git a/src/main/java/com/cultural/heritage/utils/DecoderUtils.java b/src/main/java/com/cultural/heritage/utils/DecoderUtils.java index cdfcc23..1d61770 100644 --- a/src/main/java/com/cultural/heritage/utils/DecoderUtils.java +++ b/src/main/java/com/cultural/heritage/utils/DecoderUtils.java @@ -1,5 +1,6 @@ package com.cultural.heritage.utils; +import java.nio.charset.StandardCharsets; import java.util.Base64; public class DecoderUtils { @@ -7,6 +8,7 @@ public class DecoderUtils { public static String decodeText (String text) { // Base64 解码 byte [] decodedBytes = Base64.getDecoder().decode(text); - return new String(decodedBytes); + + return new String(decodedBytes, StandardCharsets.UTF_8); } }