package com.zzsn.crawler;


import com.zzsn.configuration.SpringContextUtil;
import com.zzsn.entity.SiteMsgTemple;
import com.zzsn.awx.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.core.KafkaTemplate;

@Slf4j
public class WeixinSiteThread extends Thread{

    public SiteMsgTemple siteMsgTemple=new SiteMsgTemple();

    public KafkaTemplate kafkaTemplate= SpringContextUtil.getBean(KafkaTemplate.class);

    @Override
    public void run() {
        crawler();
    }

    public synchronized void crawler(){
        //发送公众号链接到手机微信
        try {
            SiteService sites= SpringContextUtil.getBean(SiteService.class);
            sites.sendUrlToweixin(siteMsgTemple);
            Thread.sleep(1000*90);
        }catch (Exception e){

        }

    }

}
