Commit 68f7171a authored by 技术部-任文超's avatar 技术部-任文超

简化版

parent 08f2d3ae
......@@ -100,7 +100,10 @@ public class UserController implements IBaseController {
}
// 操作标记
boolean lock = Objects.equals(Boolean.TRUE.toString(), act);
boolean valid = ValidationUtil.isValid(key, lock);
Calendar now = Calendar.getInstance();
int hour = now.get(Calendar.HOUR_OF_DAY);
boolean valid = Objects.equals(Constants.CLEAR_LOCK_FOR_IPV4_KEY+hour, key);
// Todo -- boolean valid = ValidationUtil.isValid(key, lock);
if(valid){
String lockIpv4Key = getLockIpv4Key(ip);
if(lock){
......
......@@ -66,11 +66,7 @@ public class ValidationUtil {
* @return
*/
public static boolean isValid(String key, boolean lock) {
Calendar today = Calendar.getInstance();
int hour_24 = today.get(Calendar.HOUR_OF_DAY);
StringBuilder _key = new StringBuilder();
_key.append(Constants.CLEAR_LOCK_FOR_IPV4_KEY).append(lock).append(hour_24);
return Objects.equals(key, MD5Util.build(_key.toString()));
return Objects.equals(key, getMd5Key(key, lock));
}
/**
......
package user;
import cn.quantgroup.xyqb.util.ValidationUtil;
public class TestValidUtil {
public static void main(String[] args) {
String key = ValidationUtil.getMd5Key("123", true);
System.out.println(key);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment