feat:jiekou
This commit is contained in:
@@ -43,4 +43,7 @@ public interface XUserService {
|
||||
LoginResp refresh(RefreshRequest request);
|
||||
|
||||
Boolean updateStatus(Long id, Integer status);
|
||||
|
||||
Long getUserId(String token);
|
||||
Long getTenantId(String token);
|
||||
}
|
||||
|
||||
@@ -413,4 +413,26 @@ public class XUserServiceImpl implements XUserService {
|
||||
user.setStatus(status);
|
||||
return userMapper.update(user) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getUserId(String token) {
|
||||
try {
|
||||
Jwt jwt = jwtDecoder.decode(token);
|
||||
Object userId = jwt.getClaim("userId");
|
||||
return (long) userId;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(Code01UserErrorCode.TOKEN_NOT_VALID);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getTenantId(String token) {
|
||||
try {
|
||||
Jwt jwt = jwtDecoder.decode(token);
|
||||
Object userId = jwt.getClaim("tenantId");
|
||||
return (long) userId;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(Code01UserErrorCode.TOKEN_NOT_VALID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user