import fetch from './fetch';
import { notification } from 'antd';


// 公告列表查询
export async function getNoticeList(params) {
  let res = await fetch({
    url: '/api/announcements/',
    method: 'get',
    params,
  });
  if (res.message === 'success') {
    return res.data;
  } else {
    notification.open({
      message: "提示",
      description: res.message || '请求错误',
    });
  }
}


// 公告详情查询
export async function getNoticeDetail(id) {
  let res = await fetch({
    url: '/api/announcements/' + id,
    method: 'get',
    params:{flag:1}
  });
  if (res.data) {
    return res.data;
  } else {
    notification.open({
      message: "提示",
      description: res.message || '请求错误',
    });
  }
}

//新增加密公告申请人
export function addReader(data) {
  return fetch({
    url: '/api/request_contact_reader_info/',
    method: 'post',
    data: data
  });
}


