import { request } from 'umi';
import { api } from '@/services/api'

// 获取公众列表
export async function getAdAccountAll() {
    return request(`${api}/corp/adAccount/all`);
}
//获取企微列表
export async function getCorpAccountList(params: any) {
    return request(`${api}/corp/corpAccount/list`, {
        method: 'POST',
        data: params,
    });
}
//添加企业微信
export async function addCorpAccount(params: any) {
    return request(`${api}/corp/corpAccount`, {
        method: 'POST',
        data: params,
    });
}
// 获取企业下绑定的公众号列表
export async function getListByCorpAccount(corpAccountId: any) {
    return request(`${api}/corp/corpAdConfig/listByCorpAccount/${corpAccountId}`);
}
// 绑定公众号
export async function addRelation(params: any) {
    return request(`${api}/corp/corpAdConfig/updateRelationBatch`, {
        method: 'PUT',
        data: params,
    });
}
// 请求公众号下的数据源
export async function getActionSet(adAccountId:number) {
    return request(`${api}/corp/adAccount/getActionSet/${adAccountId}`);
}
// 设置默认上报公众号源
export async function configReportDefault(params: any) {
    return request(`${api}/corp/corpAdConfig/configReportDefault`, {
        method: 'PUT',
        data: params,
    });
}