package cn.com.ctop.job.kuaishou.handler;

import cn.com.ctop.common.module.entity.CtopOauthToken;
import cn.com.ctop.common.module.service.ICtopOauthTokenService;
import cn.com.ctop.common.module.utils.Check;
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
import com.xxl.job.core.handler.annotation.XxlJob;
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);
            }
        }
    }
}
