1、不同模块登录之后,租户ID的处理,2、新增绑定短信接口
This commit is contained in:
@@ -16,16 +16,13 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<Object, Object> template = new RedisTemplate<>();
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||
template.setConnectionFactory(connectionFactory);
|
||||
|
||||
FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class);
|
||||
|
||||
FastJson2JsonRedisSerializer<Object> serializer = new FastJson2JsonRedisSerializer<>(Object.class);
|
||||
// 使用StringRedisSerializer来序列化和反序列化redis的key值
|
||||
template.setKeySerializer(new StringRedisSerializer());
|
||||
template.setValueSerializer(serializer);
|
||||
|
||||
// Hash的key也采用StringRedisSerializer的序列化方式
|
||||
template.setHashKeySerializer(new StringRedisSerializer());
|
||||
template.setHashValueSerializer(serializer);
|
||||
|
||||
@@ -16,7 +16,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class RedisCache {
|
||||
|
||||
@Resource
|
||||
public RedisTemplate redisTemplate;
|
||||
public RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
/**
|
||||
* 获得缓存的基本对象。
|
||||
@@ -25,8 +25,8 @@ public class RedisCache {
|
||||
* @return 缓存键值对应的数据
|
||||
*/
|
||||
public <T> T getCacheObject(final String key) {
|
||||
ValueOperations<String, T> operations = redisTemplate.opsForValue();
|
||||
return operations.get(key);
|
||||
ValueOperations<String, Object> operations = redisTemplate.opsForValue();
|
||||
return (T) operations.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.starry.common.utils;
|
||||
|
||||
/**
|
||||
* @author 杭州世平信息科技有限公司-xuhq
|
||||
* @since 2024/4/9 13:53
|
||||
**/
|
||||
public class VerificationCodeUtils {
|
||||
|
||||
public static String getVerificationCode(int codeLength) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < codeLength; i++) {
|
||||
sb.append((int) (Math.random() * 10));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user