|
@@ -303,8 +303,8 @@ public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken
|
|
|
private UserToken tokenSave(Long userId, String token, Integer deviceType) {
|
|
|
String lockKey = RedisKeyConstant.TOKEN_CREATE_LOCK + userId + "_" + deviceType;
|
|
|
//上锁
|
|
|
- if (!distributedLockComponent.doLock(lockKey, 0L, 3L, TimeUnit.MINUTES)) {
|
|
|
- throw new BaseException("token创建中, 请勿重复请求!");
|
|
|
+ if (!distributedLockComponent.doLock(lockKey, 0L, 1L, TimeUnit.MINUTES)) {
|
|
|
+ throw new BaseException("操作频繁, 请1分钟后重试!");
|
|
|
}
|
|
|
try {
|
|
|
UserToken userToken = UserToken.builder()
|
|
@@ -319,8 +319,6 @@ public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken
|
|
|
return userToken;
|
|
|
} catch (Exception e) {
|
|
|
throw new BaseException("创建token异常!");
|
|
|
- } finally {
|
|
|
- distributedLockComponent.unlock(lockKey);
|
|
|
}
|
|
|
}
|
|
|
|