|
@@ -16,6 +16,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
@@ -143,4 +144,29 @@ public class SysTokenServiceImpl implements SysTokenService {
|
|
|
});
|
|
|
return l > 0;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除用户token
|
|
|
+ *
|
|
|
+ * @param userIds 用户列表
|
|
|
+ * @return 删除是否成功
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Boolean deleteBatchToken(List<Long> userIds) {
|
|
|
+ Long l = (Long) redisForToken.execute(new RedisCallback<Long>() {
|
|
|
+ @Override
|
|
|
+ public Long doInRedis(RedisConnection connection) throws DataAccessException {
|
|
|
+ connection.openPipeline();
|
|
|
+ Long cnt = 0L;
|
|
|
+ for (Long userId : userIds) {
|
|
|
+ byte[] redis_key = getUserTokenKey(userId.toString());
|
|
|
+ connection.del(redis_key);
|
|
|
+ cnt++;
|
|
|
+ }
|
|
|
+ connection.closePipeline();
|
|
|
+ return cnt;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return l > 0;
|
|
|
+ }
|
|
|
}
|