package ink.wgink.module.sms.startup;

import ink.wgink.module.sms.manager.VerifyCodeManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: SmsStartUp
 * @Description: 短信模块启动
 * @Author: wanggeng
 * @Date: 2021/5/1 4:52 下午
 * @Version: 1.0
 */
@Component
public class SmsStartUp implements ApplicationRunner {

    private static final Logger LOG = LoggerFactory.getLogger(SmsStartUp.class);

    @Override
    public void run(ApplicationArguments args) throws Exception {
    }

    /**
     * 清除过期验证码任务
     */
    @Scheduled(cron = "30 * * * * ?")
    public void verificationCodeExpireTimeClearTask() {
        VerifyCodeManager.getInstance().clearExpireTimeCode();
    }
}
