import request from '@/utils/request'

// 查询新闻发布列表
export function listRelease(query) {
  return request({
    url: '/crmNewsRelease/findByPage',
    method: 'get',
    params: query
  })
}

// 查询新闻发布详细
export function getRelease(id) {
  return request({
    url: '/crmNewsRelease/getById/' + id,
    method: 'get'
  })
}

// 新增新闻发布
export function addRelease(data) {
  return request({
    url: '/crmNewsRelease/save',
    method: 'post',
    data: data
  })
}

// 修改新闻发布
export function updateRelease(data) {
  return request({
    url: '/crmNewsRelease/updateById',
    method: 'post',
    data: data
  })
}

// 删除新闻发布
export function delRelease(a) {
  if(Array.isArray(a)){
    return request.post('/crmNewsRelease/delete',a)
  }else {
    const aa = [];
    aa.push(a)
    return request.post('/crmNewsRelease/delete',aa)
  }
}

//删除图片
export const delImgById = (id) => {
  return request.get('/commonFile/deleteFileById',{
    params:{
      id
    }
  });
}

//获取新闻发布字典
export function getDict(dick) {
  return request.get('/system/dict/data/type/'+dick,{
    params:{
      dick
    }
  })
}
