package com.fdkankan.scene.schedule;

import com.fdkankan.scene.service.ISceneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ScheduleJob {

    @Autowired
    ISceneService sceneService;

    @Value("${environment}")
    private String environment;

    @Scheduled(cron = "0 0/10 * * * ? ")
    public void job4() {
        if("hq".equals(environment)){
            return;
        }
        log.info("每10分钟开始执行定时任务：更新浏览量");
        try {
            //更新浏览量
            sceneService.updatePv();
        } catch (Exception e) {
            log.error("更新浏览量定时任务出错：", e);
        }
    }

}
