import request from '@/utils/request'

// 查询小说平台
export function seekBook(data) {
    return request({
        url: '/mp-operation/platform/listOfPage',
        method: 'post',
        data: data
    })
}

// 新增小说平台
export function addBook(data) {
    return request({
        url: '/mp-operation/platform/add',
        method: 'post',
        data: data
    })
}

// 修改小说平台
export function editBook(params) {
    let { platformId, ...data } = params
    return request({
        url: '/mp-operation/platform/modify/' + platformId,
        method: 'PUT',
        data: data
    })
}

// 删除小说平台
export function delBook(params) {
    let { platformId } = params
    return request({
        url: '/mp-operation/platform/delete/' + platformId,
        method: 'DELETE'
    })
}

// 新增VIP账号
export function addVipBook(data) {
    return request({
        url: '/mp-operation/platform/account',
        method: 'post',
        data: data
    })
}

// 修改VIP平台
export function editVipBook(params) {
    let { accountId, ...data } = params
    return request({
        url: '/mp-operation/platform/account/' + accountId,
        method: 'PUT',
        data: data
    })
}

// 删除VIP账号
export function delVipBook(platformId) {
    return request({
        url: '/mp-operation/platform/account/' + platformId,
        method: 'DELETE'
    })
}

// 获取所有账号
export function getBookAcc(platformId) {
    return request({
        url: `/erp/bookPlatformAccount/listByPlatform/${platformId}`,
        method: 'GET'
    })
}
// 获取所有书
export function getBookAll() {
    return request({
        url: '/erp/book/all',
        method: 'GET'
    })
}

// 查询所有书城平台
export function getAllBook() {
    return request({
        url: '/erp/bookPlatform/all',
        method: 'GET'
    })
}