import request from '@/utils/request'

// 获取当前小区的所有公告
export function listAnnouncement(data) {
  return request({
    url: '/tpAnnouncement',
    method: 'post',
    data: {
      announcementNumber: data.announcementNumber,
      announcementTitle: data.announcementTitle,
      pageNum: data.pageNum,
      pageSize: data.pageSize
    }
  })
}
// 添加公告
export function addAnnouncement(data) {
  return request({
    url: '/addAnnouncement',
    method: 'post',
    data: {
      announcementTitle: data.announcementTitle,
      announcementCarouselImg: data.announcementCarouselImg,
      contentImg: data.contentImg,
      announcementContent: data.announcementContent,
      sort: data.sort,
      status: data.status
    }
  })
}
// 根据id查询公告
export function announcementById(data) {
  console.log(123)
  console.log(data)
  return request({
    url: '/announcementById',
    method: 'post',
    data: {
      id: data.id
    }
  })
}
// 修改公告
export function updateannouncement(data) {
  return request({
    url: '/updateAnnouncement',
    method: 'post',
    data: {
      id: data.id,
      announcementTitle: data.announcementTitle,
      announcementCarouselImg: data.announcementCarouselImg,
      contentImg: data.contentImg,
      announcementContent: data.announcementContent,
      sort: data.sort,
      status: data.status
    }
  })
}
// 批量删除(data)里面是单子字段的多个id
export function deleteAnnouncement(data) {
  return request({
    url: '/deleteAnnouncement',
    method: 'post',
    data: {
      id: data
    }
  })
}
