import request from '@/utils/request'

// 查询用户列表
// export function listAd(query) {
//     return request({
//         url: '/mp-operation/adMpInfo/list',
//         method: 'get',
//         params: query
//     })
// }
export function listAd(data) {
    return request({
        url: '/adq/admin/adAccount/list',
        method: 'POST',
        data
    })
}

// 广告平台授权
export function getAd(query) {
    return request({
        url: '/mp-operation/mp/adAuth',
        method: 'get',
        params: query
    })
}

// 老广告平台授权
export function getAdt(query) {
    return request({
        url: '/mp-operation/mp/adAuthOld',
        method: 'get',
        params: query
    })
}
// 老扫码成功后 在请求
export function adtAuthSuccess(query) {
    return request({
        url: `/mp-operation/mp/adAuthSuccessOld`,
        method: 'get',
        params: query
    })
}
// 荣哥新 成功后 在请求
export function adtDoAuth(query) {
    return request({
        url: `/adq/admin/adAccount/doAuth`,
        method: 'POST',
        params: query
    })
}

export function adtYwdyDoAuth(query) {
    return request({
        // url: `/adq/admin/adAccount/adUnit/doAuth`,
        url: `/adq/admin/adAccount/adUnit/doAuthV2`,
        method: 'POST',
        params: query
    })
}

// 荣新授权
export function toAuth(query) {
    return request({
        url: '/adq/admin/adAccount/toAuthV2',
        // url: '/adq/admin/adAccount/toAuth',
        method: 'POST',
        params: query
    })
}

// 扫码成功后 在请求
export function adAuthSuccess(query) {
    return request({
        url: `/mp-operation/mp/adAuthSuccess`,
        method: 'get',
        params: query
    })
}

// 列表编辑
export function editAdMp(data) {
    return request({
        url: '/mp-operation/adMpInfo',
        method: 'post',
        data: data
    })
}

// 列表删除
export function deleteAdMp(id) {
    return request({
        url: '/mp-operation/adMpInfo/' + id,
        method: 'DELETE',
    })
}

// 切号
export function switchAcc(data) {
    return request({
        url: '/mp-operation/adMpInfo/accountChange',
        method: 'post',
        data: data
    })
}

// 切书
export function switchBook(data) {
    return request({
        url: '/mp-operation/adMpInfo/bookChange',
        method: 'post',
        data: data
    })
}

// 切投手
export function switchPitcher(data) {
    return request({
        url: '/mp-operation/adMpInfo/pitcherChange',
        method: 'post',
        data: data
    })
}

// 切平台
export function switchPlatform(data) {
    return request({
        url: '/mp-operation/adMpInfo/platformChange',
        method: 'post',
        data: data
    })
}

// 切号记录接口
export function getSwitchAcc(query) {
    return request({
        url: `/mp-operation/adMpInfo/accountChangeList`,
        method: 'get',
        params: query
    })
}

// 切书记录接口
export function getSwitchBook(query) {
    return request({
        url: `/mp-operation/adMpInfo/bookChangeList`,
        method: 'get',
        params: query
    })
}

// 切投手记录接口
export function getSwitchPitche(query) {
    return request({
        url: `/mp-operation/adMpInfo/pitcherChangeList`,
        method: 'get',
        params: query
    })
}

// 切平台记录接口
export function getSwitchPlatform(query) {
    return request({
        url: `/mp-operation/adMpInfo/platformChangeList`,
        method: 'get',
        params: query
    })
}

// 获取腾讯广告管理列表
export function getAdAppList(data) {
    return request({
        url: `/adq/admin/adApp/list`,
        method: 'POST',
        data
    })
}
// 获取所有腾讯广告管理列表
export function getAdAppListAll() {
    return request({
        url: `/adq/admin/adApp/all`,
        method: 'GET'
    })
}
// 新增腾讯广告管理列表
export function addApp(data) {
    return request({
        url: `/adq/admin/adApp`,
        method: 'POST',
        data
    })
}
// 修改腾讯广告管理列表
export function editApp(data) {
    let { adAppId, ...params } = data
    return request({
        url: `/adq/admin/adApp/${adAppId}`,
        method: 'PUT',
        data: params
    })
}

// 刷新服务商
export function refreshByIds(data) {
    return request({
        url: `/adq/admin/adAccount/refreshByIds`,
        method: 'PUT',
        data
    })
}


// 切换投手
export function cutPut({ adAccountId, putUserId }) {
    return request({
        url: `/adq/admin/adAccount/configPutUser/${adAccountId}/${putUserId}`,
        method: 'PUT'
    })
}

export function addAccountUser(data) {
    return request({
        url: `/adq/admin/adAccount/modifyAccountUser`,
        method: 'POST',
        data
    })
}