mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-22 12:48:59 +08:00
fix: 未登录会员是否登录判断错误问题修复
This commit is contained in:
parent
7d20277b59
commit
cb9dff16f4
@ -44,7 +44,7 @@ public class SpuController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取秒杀商品列表")
|
||||
@GetMapping("/seckilling_list")
|
||||
@GetMapping("/seckillList")
|
||||
public Result<List<SeckillingSpuVO>> listSeckillingSpu() {
|
||||
List<SeckillingSpuVO> list = spuService.listSeckillingSpu();
|
||||
return Result.success(list);
|
||||
|
@ -162,8 +162,8 @@ public class PmsSpuServiceImpl extends ServiceImpl<PmsSpuMapper, PmsSpu> impleme
|
||||
}
|
||||
|
||||
// 添加用户浏览历史记录
|
||||
Long loginUserId = SecurityUtils.getMemberId();
|
||||
if (loginUserId != null) {
|
||||
Long memberId = SecurityUtils.getMemberId();
|
||||
if (memberId != null) {
|
||||
ProductHistoryVO vo = new ProductHistoryVO();
|
||||
vo.setId(goodsInfo.getId());
|
||||
vo.setName(goodsInfo.getName());
|
||||
|
@ -70,7 +70,7 @@ public class SecurityUtils {
|
||||
*/
|
||||
public static Set<String> getRoles() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication!=null && CollectionUtil.isNotEmpty(authentication.getAuthorities())) {
|
||||
if (authentication != null && CollectionUtil.isNotEmpty(authentication.getAuthorities())) {
|
||||
Set<String> roles = authentication.getAuthorities()
|
||||
.stream()
|
||||
.map(item -> StrUtil.removePrefix(item.getAuthority(), "ROLE_"))
|
||||
@ -111,8 +111,13 @@ public class SecurityUtils {
|
||||
|
||||
public static Map<String, Object> getTokenAttributes() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null) {
|
||||
if (authentication instanceof JwtAuthenticationToken) {
|
||||
JwtAuthenticationToken jwtAuthenticationToken = (JwtAuthenticationToken) authentication;
|
||||
Map<String, Object> tokenAttributes = jwtAuthenticationToken.getTokenAttributes();
|
||||
return tokenAttributes;
|
||||
}
|
||||
}
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user