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.CtopAdConstant;
import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
import com.xxl.job.core.handler.annotation.XxlJob;
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());
    }
}
