import request from '@/utils/request'

export function uploadCreditHtml(files) {
  const formData = new FormData()
  files.forEach((file) => {
    formData.append('files', file)
  })

  return request({
    url: '/ccdi/creditInfo/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

export function listCreditInfo(query) {
  return request({
    url: '/ccdi/creditInfo/list',
    method: 'get',
    params: query
  })
}

export function getCreditInfoDetail(personId) {
  return request({
    url: '/ccdi/creditInfo/' + encodeURIComponent(personId),
    method: 'get'
  })
}

export function deleteCreditInfo(personId) {
  return request({
    url: '/ccdi/creditInfo/' + personId,
    method: 'delete'
  })
}
