修复sessionbug

This commit is contained in:
chen-xin-zhi 2025-05-06 13:25:03 +08:00
parent 6ed9ce354a
commit 87ea5dfd55
5 changed files with 8 additions and 5 deletions

View File

@ -309,7 +309,7 @@ public class ClothesController {
*/ */
@GetMapping("/facelift") @GetMapping("/facelift")
@Operation(summary = "小程序端用户调用换装api", description = "参数服装id权限管理员(admin, boss)方法名updateClothesShelvesStatus") @Operation(summary = "小程序端用户调用换装api", description = "参数服装id权限管理员(admin, boss)方法名updateClothesShelvesStatus")
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE) @AuthCheck(mustRole = UserConstant.DEFAULT_ROLE)
public BaseResponse<String> invokeChangeClothesApi(@RequestParam String modelURL, @RequestParam String clothesURL) { public BaseResponse<String> invokeChangeClothesApi(@RequestParam String modelURL, @RequestParam String clothesURL) {
if (StringUtils.isBlank(modelURL) || StringUtils.isBlank(clothesURL)) { if (StringUtils.isBlank(modelURL) || StringUtils.isBlank(clothesURL)) {
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数不能为空"); throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数不能为空");

View File

@ -65,6 +65,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
HttpSession session = request.getSession(); HttpSession session = request.getSession();
System.out.println(session); System.out.println(session);
session.setAttribute(USER_LOGIN_STATE, user); session.setAttribute(USER_LOGIN_STATE, user);
session.setMaxInactiveInterval(10);
return this.getUserVO(user); return this.getUserVO(user);
} }
@ -192,7 +193,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
this.save(user); this.save(user);
// 记住用户的登录态 // 记住用户的登录态
} }
request.getSession().setAttribute(USER_LOGIN_STATE, user); HttpSession session = request.getSession();
session.setAttribute(USER_LOGIN_STATE, user);
session.setMaxInactiveInterval(10);
return this.getUserVO(user); return this.getUserVO(user);
} }
} }

View File

@ -47,7 +47,7 @@ server:
session: session:
cookie: cookie:
max-age: 2592000 max-age: 2592000
timeout: 2592000 # timeout: 2592000
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml

View File

@ -52,7 +52,7 @@ server:
session: session:
cookie: cookie:
max-age: 2592000 max-age: 2592000
timeout: 2592000 # timeout: 2592000
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml

View File

@ -55,7 +55,7 @@ server:
session: session:
cookie: cookie:
max-age: 2592000 max-age: 2592000
timeout: 720h # timeout: 720h
mybatis-plus: mybatis-plus:
mapper-locations: classpath:mapper/*.xml mapper-locations: classpath:mapper/*.xml