import request from '@/core/utils/request'

// 保存草稿/更新文章
export function save (data) {
  return request.post('/cms/article/save', data)
}

// 发布
export function publish (id) {
  return request.get(`/cms/article/publish/${id}`)
}

// 上线
export function online (id) {
  return request.get(`/cms/article/online/${id}`)
}

// 批量上线
export function onlineInBatch (ids) {
  return request.get('/cms/article/online/batch', {
    params: {
      ids
    }
  })
}

// 下线
export function offline (id) {
  return request.get(`/cms/article/offline/${id}`)
}

// 批量下线
export function offlineInBatch (ids) {
  return request.get('/cms/article/offline/batch', {
    params: {
      ids
    }
  })
}

// 根据ID删除
export function deleteById (id) {
  return request.get(`/cms/article/delete/${id}`)
}

// 批量删除
export function deleteByIdInBatch (ids) {
  return request.get('/cms/article/delete/batch', {
    params: {
      ids
    }
  })
}

// 分页查询
export function fetchPage (data) {
  return request.post('/cms/article/page', data)
}

// 为文章下拉选择查询概要信息列表
export function fetchProfileList4Select (data) {
  return request.post('/cms/article/select/list', data)
}
