
import request from '@/utils/request'

// 新增
export function cmsAdd(data, type) {
  return request({
    url: `/cms/${type}`,
    method: 'post',
    data
  })
}

// 删除
export function cmsDel(type, id) {
  return request({
      url: `/cms/${type}/${id}`,
      method: 'delete'
  })
}

// 修改
export function cmsUpdate(data, type) {
  return request({
    url: `/cms/${type}`,
    method: 'put',
    data: data
  })
}

// 查询List
export function cmsQuery(query, type, alias) {
  return request({
    url: `/cms/${type}${alias ? '/' + alias : ''}/list`,
    method: 'get',
    params: query
  })
}

// 查询详情
export function cmsFetch(suffix, type) {
  return request({
    url: `/cms/${type}/${suffix}`,
    method: 'get'
  })
}

// 审核
export function cmsReview(data) {
  return request({
    url: `/cms/custom/review/${data.postId}`,
    method: 'post',
    data
  })
}
