import axios from '@/utils/request'

// 查询公告列表
export function listAnnouncement(query) {
  return axios.get('/announcement/list',{
    params: {
      ...query
    }
  })
}

// 查询全部公告列表
export function listAllAnnouncement(query) {
  return axios.get('/announcement/listAll', {
    params: {
      ...query
    }
  })
}

// 查询公告详细
export function getAnnouncement(id) {
  return axios.get('/announcement/info/' + id)
}

// 新增公告
export function addAnnouncement(data) {
  return axios.post('/announcement/add', {
    ...data
  })
}

// 修改公告
export function updateAnnouncement(data) {
  return axios.put('/announcement', data)
}

// 设为置顶（保证仅一个置顶）
export function setTopAnnouncement(id) {
  return axios.put('/announcement/setTop/' + id)
}

// 删除公告
export function delAnnouncement(id) {
  return axios.delete('/announcement/' + id)
}

// 游客端公告列表（置顶 + 普通分页）
export function listTouristAnnouncements(params) {
  return axios.get('/announcement/touristList', { params })
}
