import ajax from "@/utils/request.js";
import fileDownload from "@/utils/download.js";

// 全国接口

/**
 *
 * @param {*} data
 * @returns {AxjxPromise}
 */
export function selectDate(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/absepg_filter",
    method: "POST",
    data,
  });
}
/**
 *
 * @param {*} data
 * @returns {AxjxPromise}
 */
export function epgselectDate(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/epg_filter",
    method: "POST",
    data,
  });
}

/**
 *
 * @param {*} data
 * @returns {AxjxPromise}
 */
export function tvselectDate(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/tv_filter",
    method: "POST",
    data,
  });
}

/**
 * 频道全天节目
 * 表格查询
 * @props {}
 * @return {AxjxPromise}
 */
export function allDayEpg(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/broadcast/list",
    method: "get",
    data,
  });
}

/**
 * 节目查询
 * @props kw&ft
 * @return {AxjxPromise}
 */
export function overlapSearchTitle(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/search_suggest?" + data,
    method: "GET",
  });
}

/**
 * 节目查询
 * @props kw&ft
 * @return {AxjxPromise}
 */
export function epgAggregate(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/EpgListByCaIdGrowAction?" + data,
    method: "GET",
  });
}

// 重叠度
/**
 * 节目重叠度
 * 图表查询
 * @props epg_ids=&area_id=
 * @return {AxjxPromise}
 */
export function overlap(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/ProUserOverlapAction?" + data,
    method: "GET",
  });
}
// 电视剧排播信息及表现（全国）
/**
 * 节目排行-同时段频道
 * @props epg_id=&area_id=
 * @return {AxjxPromise}
 */
export function summary(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/EpgPeriodLeaderboardTvAction?" + data,
    method: "GET",
  });
}
/**
 * 节目排行-同时段频道导出
 * @props epg_id=&area_id=&domain=pro.eye.kuyun.com%2F&download=csv&page_no=1&page_size=10000
 */
export function summaryExport(data, fileName) {
  fileDownload(
    {
      urlType: "kuyunApi",
      url:
        "/api/evaluation/eye/download/api/eye/EpgPeriodLeaderboardTvAction?" +
        data,
      method: "GET",
    },
    fileName
  );
}
/**
 * 节目排行-同时段节目
 * @props epg_id=&area_id=
 * @return {AxjxPromise}
 */
export function program(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/EpgPeriodLeaderboardAction?page_no=1&" + data,
    method: "GET",
  });
}
/**
 * 节目排行-同时段节目导出
 * @props epg_id=&area_id=&domain=pro.eye.kuyun.com%2F&download=csv&page_no=1&page_size=10000
 */
export function programExport(data, fileName) {
  fileDownload(
    {
      urlType: "kuyunApi",
      url:
        "/api/evaluation/eye/download/api/eye/EpgPeriodLeaderboardAction?" +
        data,
      method: "GET",
    },
    fileName
  );
}
/**
 * 节目排行-同时段多节目
 * @props epg_ids=&area_id=
 * @return {AxjxPromise}
 */
export function programs(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/epgkpi/summary?" + data,
    method: "GET",
  });
}
/**
 * 节目排行-同时段节目导出
 * @props epg_ids=&area_id=&domain=api.eye.kuyun.com
 */
export function programsExport(data, fileName) {
  fileDownload(
    {
      urlType: "kuyunApi",
      url:
        "/api/evaluation/eye/download/performance/epgkpi/summary/download?" +
        data,
      method: "GET",
    },
    fileName
  );
}
//

/**
 * 抽象节目剧目
 * @props epg_ids=&area_id=
 * @return {AxjxPromise}
 */
export function country(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/absepgkpi",
    method: "POST",
    data,
  });
}

/**
 * 居图节目剧目
 * @props epg_ids=&area_id=
 * @return {AxjxPromise}
 */
export function epgcountry(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/epgkpi",
    method: "POST",
    data,
  });
}

/**
 * 单期节目流入流出
 * @props epg_ids=&area_id=
 * @return {AxjxPromise}
 */
export function singleProgram(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/EpgInputOutputAction?kpi=tv_ratings&" + data,
    method: "GET",
  });
}

/**
 * 实时节目流入流出
 * @props area_id=&tv_id=48
 * @return {AxjxPromise}
 */
export function realflow(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/TimelyTvInputOutputAction?" + data,
    method: "GET",
  });
}

/**
 * 频道分地区
 * @props
 * @return {AxjxPromise}
 */
export function tvcountry(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/performance/tvkpi",
    method: "POST",
    data,
  });
}
/**
 * 频道分地区
 * @props
 * @return {AxjxPromise}
 */
export function tvvscountry(data) {
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/TvDailyAVGKPITrendAction?" + data,
    method: "get",
  });
}
/**
 * tvList
 * @props
 * @return {AxjxPromise}
 */
export function tvlist(){
  return ajax({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/ProChannelListAction",
    method: "get",
  });
}
/**
 * tvList
 * @props
 * @return {AxjxPromise}
 */
export function tvlistexport(data,fileName,  call){
  return fileDownload({
    urlType: "kuyunApi",
    url: "/api/evaluation/eye/download/api/eye/TvDailyAVGKPITrendAction?" + data,
    method: "get",
  },fileName, call);
}


/**
 * tvList
 * @props
 * @return {AxjxPromise}
 */
 export function tvrange(data){
    return ajax({
      urlType: "kuyunApi",
      url: "/api/evaluation/eye/TvKPILeaderboardAction",
      method: "get",
      data
    });
  }
  /**
   * tvList 导出
   * @props
   * @return {AxjxPromise}
   */
  export function tvrangeexport(data,fileName,  call){
    return fileDownload({
      urlType: "kuyunApi",
      url: "/api/evaluation/eye/download/api/eye/TvKPILeaderboardAction",
      data,
      method: "get",
    },fileName, call);
  }