Compare commits
4
Commits
ebaeb1ac56
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9c7c098c8 | ||
|
|
a4a9317731 | ||
|
|
cf701b18fa | ||
|
|
f42b833e3e |
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.spring</groupId>
|
<groupId>com.imyeyu.spring</groupId>
|
||||||
<artifactId>timi-spring</artifactId>
|
<artifactId>timi-spring</artifactId>
|
||||||
<version>0.0.17</version>
|
<version>0.0.19</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.lang.annotation.Target;
|
|||||||
/**
|
/**
|
||||||
* 应用在 Controller 的接口上
|
* 应用在 Controller 的接口上
|
||||||
*
|
*
|
||||||
* <p>{@link #lifeCycle()} 生命周期内(秒)限制访问 {@link #value()} 次
|
* <p>{@link #inSeconds()} 生命周期内(秒)限制访问 {@link #value()} 次
|
||||||
*
|
*
|
||||||
* @author 夜雨
|
* @author 夜雨
|
||||||
* @version 2021-08-16 17:57
|
* @version 2021-08-16 17:57
|
||||||
@@ -32,5 +32,5 @@ public @interface RequestRateLimit {
|
|||||||
*
|
*
|
||||||
* @return 生命周期秒数
|
* @return 生命周期秒数
|
||||||
*/
|
*/
|
||||||
int lifeCycle() default 10;
|
int inSeconds() default 10;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class RequestRateLimitAbstractInterceptor implements HandlerInte
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// 频率限制
|
// 频率限制
|
||||||
return beforeRun(req, resp, buildId(handlerMethod), requestRateLimit.lifeCycle(), requestRateLimit.value());
|
return beforeRun(req, resp, buildId(handlerMethod), requestRateLimit.inSeconds(), requestRateLimit.value());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,34 +37,6 @@ public class Page<T> extends BasePage {
|
|||||||
/** 排序字段映射 */
|
/** 排序字段映射 */
|
||||||
protected LinkedHashMap<String, BaseMapper.OrderType> orderMap;
|
protected LinkedHashMap<String, BaseMapper.OrderType> orderMap;
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建分页参数
|
|
||||||
*
|
|
||||||
* @param index 页码
|
|
||||||
* @param size 每页数量
|
|
||||||
*/
|
|
||||||
public Page(int index, int size) {
|
|
||||||
super(index, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取偏移量
|
|
||||||
*
|
|
||||||
* @return 偏移量
|
|
||||||
*/
|
|
||||||
public long getOffset() {
|
|
||||||
return (long) index * size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取限制数量
|
|
||||||
*
|
|
||||||
* @return 限制数量
|
|
||||||
*/
|
|
||||||
public long getLimit() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加排序字段
|
* 添加排序字段
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import com.imyeyu.java.TimiJava;
|
|||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import com.imyeyu.spring.config.AbstractRedisConfig;
|
import com.imyeyu.spring.config.AbstractRedisConfig;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.springframework.data.redis.connection.RedisConnection;
|
import org.springframework.data.redis.connection.RedisConnection;
|
||||||
import org.springframework.data.redis.core.Cursor;
|
import org.springframework.data.redis.core.Cursor;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
@@ -30,8 +28,6 @@ import java.util.function.Consumer;
|
|||||||
* @author 夜雨
|
* @author 夜雨
|
||||||
* @version 2021-11-21 09:58
|
* @version 2021-11-21 09:58
|
||||||
*/
|
*/
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Redis<K, V> {
|
public class Redis<K, V> {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user