package com.xxl.job.executor.jobhandler;

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.common.service.ICtopOauthTokenService;
import com.xxl.job.executor.utils.CtopAdConstant;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class KuaishouTargetingTagsJob {
    @Autowired
    private IKuaishouInterfaceService kuaishouInterfaceService;
    @Autowired
    private ICtopOauthTokenService oauthTokenService;

    /**
     * 定时更新 快手 标签
     * @throws JobExecutionException
     */
    @XxlJob("kuaishouTargetingTagsJob")
    public void execute()throws Exception {
        CtopOauthToken token = oauthTokenService.selectOneByMediaId(CtopAdConstant.PLATFORM_TYPE_KUAISHOU);
        kuaishouInterfaceService.getTargetingTags(token.getAccountId(), token.getAccessToken());
        kuaishouInterfaceService.areaList(token.getAccessToken());
    }
}
