ipo
zyy3
2026-01-06 97f6fdc09138a2346b61ccc4c716e87ab58e590f
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.service.impl;
 
import com.yami.trading.service.IdentifyingCodeTimeWindowService;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
 
import java.util.concurrent.TimeUnit;
 
@Service
public class IdentifyingCodeTimeWindowServiceImpl implements IdentifyingCodeTimeWindowService {
 
    @Autowired
    private RedisTemplate redisTemplate;
 
    @Override
    public String getAuthCode(String key) {
        Object authCode = redisTemplate.opsForValue().get(key);
        if (authCode != null) {
            return String.valueOf(authCode);
        }
        return null;
    }
 
    @Override
    public void putAuthCode(String key, String authCode) {
        redisTemplate.opsForValue().set(key, authCode, 10, TimeUnit.MINUTES);
    }
 
    @Override
    public void delAuthCode(String key) {
        redisTemplate.delete(key);
    }
}