import request from '@/utils/request'

// 分页查询域名列表
export function pageDomain(query) {
  return request({
    url: '/adv/domains/page',
    method: 'get',
    params: query
  })
}

// 根据ID查询域名详情
export function getDomain(id) {
  return request({
    url: '/adv/domains/' + id,
    method: 'get'
  })
}

// 新增域名
export function addDomain(data) {
  return request({
    url: '/adv/domains',
    method: 'post',
    data: data
  })
}

// 更新域名
export function updateDomain(id, data) {
  return request({
    url: '/adv/domains/' + id,
    method: 'put',
    data: data
  })
}

// 删除域名
export function delDomain(id) {
  return request({
    url: '/adv/domains/' + id,
    method: 'delete'
  })
}

// 批量删除域名
export function batchDelDomain(ids) {
  return request({
    url: '/adv/domains/batch',
    method: 'delete',
    data: ids
  })
}

// 启用/禁用域名
export function updateDomainStatus(id, status) {
  return request({
    url: '/adv/domains/' + id + '/status',
    method: 'put',
    params: { status }
  })
}

