import http from '@/utils/http'
import { AppDispatch } from '..'
/**
 *意见反馈记录-列表
 */
export const D1_APIgetList = (data: any): any => {
  return async (dispatch: AppDispatch) => {
    const res = await http.post('museum/feedback/page', data)
    if (res.code === 0) {
      const obj = {
        list: res.data.records,
        total: res.data.total
      }
      dispatch({ type: 'D1/getList', payload: obj })
    }
  }
}

/**
 * 意见反馈记录-删除
 */
export const D1_APIdel = (id: number) => {
  return http.post(`museum/feedback/del/${id}`)
}

/**
 * 意见反馈记录-新增
 */
export const D1_APIadd = (data: any) => {
  return http.post('museum/feedback/add', data)
}

/**
 * 意见反馈记录-详情
 */
export const D1_APIgetInfo = (id: number) => {
  return http.post(`museum/feedback/info/${id}`)
}

/**
 * 意见反馈记录-导出
 */
export const D1_APIexportExcel = () => {
  // return `https://sit-kelamayi.4dage.com/api/museum/feedback/exportExcel`
  return http.get('museum/feedback/exportExcel', { responseType: 'blob' })
}
