import service from '@/utils/request'

// @Summary 获取文章列表
// @Produce  application/json
// @Router /cms/article/getList [post]
export const getArticleList = (data) => {
  return service({
    url: '/cms/article/getList',
    method: 'post',
    data
  })
}

// @Summary 新增文章
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/add [post]
export const addArticle = (data) => {
  return service({
    url: '/cms/article/add',
    method: 'post',
    data
  })
}

// @Summary 删除文章
// @Produce  application/json
// @Param ID int
// @Router /cms/article/delete [delete]
export const deleteArticle = (data) => {
  return service({
    url: '/cms/article/delete',
    method: 'delete',
    data
  })
}

// @Summary 批量删除文章
// @Param data body request.IdsReq true "批量删除文章"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /product/deleteProduct [delete]
export const deleteArticleByIds = (params) => {
  return service({
    url: '/cms/article/deleteByIds',
    method: 'delete',
    params
  })
}

// @Summary 修改文章
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/update [put]
export const updateArticle = (data) => {
  return service({
    url: '/cms/article/update',
    method: 'put',
    data
  })
}

// @Tags 文章
// @Summary 根据id获取文章
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.GetById true "根据id获取文章"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /cms/article/get [get]
export const getArticleById = (params) => {
  return service({
    url: '/cms/article/get',
    method: 'get',
    params
  })
}

// @Summary 文章提审
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/submit [put]
export const submitArticle = (data) => {
  return service({
    url: '/cms/article/submit',
    method: 'put',
    data
  })
}

// @Summary 文章审核
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/review [put]
export const reviewBackArticle = (data) => {
  return service({
    url: '/cms/article/reviewBack',
    method: 'put',
    data
  })
}

// @Summary 文章发布
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/release [put]
export const releaseArticle = (data) => {
  return service({
    url: '/cms/article/release',
    method: 'put',
    data
  })
}

// @Summary 文章撤销
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/cancel [put]
export const cancelArticle = (data) => {
  return service({
    url: '/cms/article/cancel',
    method: 'put',
    data
  })
}

// @Summary 更新文章所属栏目
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/setChannels [put]
export const setArticleChannels = (data) => {
  return service({
    url: '/cms/article/setChannels',
    method: 'put',
    data
  })
}

// @Summary 更新文章分类
// @Produce  application/json
// @Param menu Object
// @Router /cms/article/setChannels [put]
export const setArticleCategories = (data) => {
  return service({
    url: '/cms/article/setCategories',
    method: 'put',
    data
  })
}
