修复高危漏洞接口——对外放行的,把岗位id加密

This commit is contained in:
sh
2026-04-21 12:59:36 +08:00
parent 6c6e61cb87
commit c85ff33840
6 changed files with 164 additions and 41 deletions

View File

@@ -278,4 +278,39 @@ public class RedisCache
Boolean result = redisTemplate.opsForValue().setIfAbsent(key, value, timeout, unit);
return Boolean.TRUE.equals(result);
}
/**
* 新增自增方法
* @param key 键
* @return 自增后的值
*/
public Long increment(String key) {
return redisTemplate.opsForValue().increment(key);
}
/**
* 重载:指定步长自增
* @param key 键
* @param step 步长
* @return 自增后的值
*/
public Long increment(String key, long step) {
return redisTemplate.opsForValue().increment(key, step);
}
/**
* 重载:自增并设置过期时间
* @param key 键
* @param step 步长
* @param expireTime 过期时间
* @param timeUnit 时间单位
* @return 自增后的值
*/
public Long increment(String key, long step, long expireTime, TimeUnit timeUnit) {
Long value = redisTemplate.opsForValue().increment(key, step);
if (value != null) {
redisTemplate.expire(key, expireTime, timeUnit);
}
return value;
}
}