新版仿ok交易所-后端
1
zyy
2025-12-18 2462671fc9f457a50eb584d852e6273aec2a5a37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.yami.trading.common.manager;
 
import com.yami.trading.common.util.TimeWindow;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
 
 
@Component
public class BlacklistIpTimeWindow{
    private TimeWindow timeWindow = new TimeWindow();
 
     public  BlacklistIpTimeWindow(){
         /**
          * 24小时
          */
         this.timeWindow.setTimeSize(60 * 60 * 24);
         this.timeWindow.start();
     }
 
    public String getBlackIp(String key) {
        Object authcode = this.timeWindow.findObject(key);
        if (authcode != null) {
            return String.valueOf(authcode.toString());
        }
        return null;
    }
 
    public void putBlackIp(String key, String ip) {
        this.timeWindow.add(key, ip);
    }
 
    public void delBlackIp(String key) {
        this.timeWindow.remove(key);
    }
}