package com.xxl.job.executor.jobhandler;

import cn.com.ctop.common.module.service.ICtopOauthTokenService;
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.executor.common.entity.CtopOauthToken;
import com.xxl.job.executor.utils.Check;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class KuaishouDailyFlowsJob {
    @Autowired
    private IKuaishouInterfaceService kuaishouInterfaceService;
    @Autowired
    private ICtopOauthTokenService oauthTokenService;
    @XxlJob("kuaishouDailyFlowsJob")
    public void execute() {
        List<CtopOauthToken> tokens = oauthTokenService.selectKuaiShouToken();
        if (!Check.isNull(tokens)) {
            for (CtopOauthToken ctopOauthToken : tokens) {
                kuaishouInterfaceService.getDailyFlows(ctopOauthToken);
            }
        }
    }
}
