package com.zhongshu.card.server.core.init;

import com.zhongshu.card.server.core.util.wx.WechatCUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;

/**
 * @author TRX
 * @date 2024/6/11
 */
@Component
@Slf4j
public class WxInit implements CommandLineRunner {

    @Autowired
    WechatCUtil wechatCUtil;

    @Override
    public void run(String... args) throws Exception {
        log.info("SuperCountInit");
        CompletableFuture.runAsync(() -> {
            try {
                TimeUnit.SECONDS.sleep(12);
                log.info("---------初始微信token信息-----------");
                wechatCUtil.init();
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
}
