|
@@ -32,6 +32,11 @@ public enum Using implements Enumerable {
|
|
*/
|
|
*/
|
|
NORMAL("普通请求");
|
|
NORMAL("普通请求");
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 默认使用刷新时间间隔(15分钟)
|
|
|
|
+ */
|
|
|
|
+ public static final int DEFAULT_NEWLY_INTERVAL = 15 * 60 * 1000;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 类别描述
|
|
* 类别描述
|
|
*/
|
|
*/
|
|
@@ -42,18 +47,28 @@ public enum Using implements Enumerable {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 根据上次使用时间及注册时间结算使用类型
|
|
|
|
- * <p>
|
|
|
|
- * 如果距离上次使用时间超过15分钟我(900000毫秒)则视为重新进入系统
|
|
|
|
|
|
+ * 根据上次使用时间及注册时间计算使用类型
|
|
*
|
|
*
|
|
* @param latest 上次使用时间戳
|
|
* @param latest 上次使用时间戳
|
|
* @param registering 用户注册时间戳
|
|
* @param registering 用户注册时间戳
|
|
* @return 使用类型枚举
|
|
* @return 使用类型枚举
|
|
*/
|
|
*/
|
|
public static Using from(Long latest, Long registering) {
|
|
public static Using from(Long latest, Long registering) {
|
|
|
|
+ return from(latest, registering, DEFAULT_NEWLY_INTERVAL);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据上次使用时间及注册时间计算使用类型
|
|
|
|
+ *
|
|
|
|
+ * @param latest 上次使用时间戳
|
|
|
|
+ * @param registering 用户注册时间戳
|
|
|
|
+ * @param interval 使用刷新时间间隔(毫秒)
|
|
|
|
+ * @return 使用类型枚举
|
|
|
|
+ */
|
|
|
|
+ public static Using from(Long latest, Long registering, long interval) {
|
|
if (latest == null) {
|
|
if (latest == null) {
|
|
return registering == null || registering < DateUtils.today().getTime() ? DAILY : INITIAL;
|
|
return registering == null || registering < DateUtils.today().getTime() ? DAILY : INITIAL;
|
|
}
|
|
}
|
|
- return System.currentTimeMillis() - latest > 900000 ? NEWLY : NORMAL;
|
|
|
|
|
|
+ return System.currentTimeMillis() - latest > interval ? NEWLY : NORMAL;
|
|
}
|
|
}
|
|
}
|
|
}
|