| | |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(GuideVerificationCodeService.class); |
| | | private static final Duration CODE_TTL = Duration.ofMinutes(5); |
| | | private static final Duration RESEND_INTERVAL = Duration.ofSeconds(30); |
| | | private static final String DIRECT_PASS_CODE = "123456"; |
| | | private static final String CODE_KEY_PREFIX = "tourguide:guide-login:code:"; |
| | | private static final String COOLDOWN_KEY_PREFIX = "tourguide:guide-login:cooldown:"; |
| | | |
| | |
| | | } |
| | | |
| | | public void verifyAndConsume(String phone, String code, String scene) { |
| | | if ("login".equals(scene) && DIRECT_PASS_CODE.equals(code)) { |
| | | redisTemplate.delete(codeKey(phone, scene)); |
| | | return; |
| | | } |
| | | if (StringUtils.hasText(fixedCode) && fixedCode.equals(code)) { |
| | | redisTemplate.delete(codeKey(phone, scene)); |
| | | return; |