import request from '@/utils/request'

// 查询锚点列表
export function getAnchorList(query) {
  return request({
    url: '/ibs/anchor/List',
    method: 'get',
    params: query
  })
}
// 获取试图id
export function getCust(query) {
  return request({
    url: '/ibs/anchor/getCust',
    method: 'get',
    params: query
  })
}
// 查询审核地址列表
export function getAuditList(query) {
  return request({
    url: '/ibs/anchor/AuditList',
    method: 'get',
    params: query
  })
}

// 查询已忽略地址列表
export function getIgnoreList(query) {
  return request({
    url: '/ibs/anchor/IgnoreList',
    method: 'get',
    params: query
  })
}

//上传文件
export function uploadFile(data, id) {
  return request({
    url: `/ibs/anchor/importModel?userid=${id}`,
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data: data
  })
}


export function importQyModel(data) {
  return request({
    url: '/ibs/anchor/importQyModel',
    method: 'post',
    data: data
  })
}

export function importGrModel(data) {
  return request({
    url: '/ibs/anchor/importGrModel',
    method: 'post',
    data: data
  })
}

//下载模板
export function downloadFile() {
  return request({
    url: '/ibs/anchor/exportModel',
    method: 'get',
    responseType: 'blob'
  })
}

//锚点详情
export function getAnchorDetail(query) {
  return request({
    url: '/ibs/anchor/Detail',
    method: 'get',
    params: query
  })
}

//导出失败个人模板
export function exportFailGr(params) {
  return request({
    url: '/ibs/anchor/exportFailGr',
    method: 'post',
    responseType: 'blob',
    data: params
  })
}
//导出失败企业、商户模板
export function exportFailQy(params) {
  return request({
    url: '/ibs/anchor/exportFailQy',
    method: 'post',
    responseType: 'blob',
    data: params
  })
}

//锚点编辑
export function updateAnchor(data, id) {
  return request({
    url: `/ibs/anchor/UpdateAnchor?userid=${id}`,
    method: 'post',
    data: data
  })
}

//锚点删除
export function DelAnchor(data) {
  return request({
    url: '/ibs/anchor/DelAnchor',
    method: 'post',
    data: data
  })
}

//锚点审核-地址通过
export function PassAudit(data) {
  return request({
    url: 'ibs/anchor/AuditAddressUp',
    method: 'post',
    data: data
  })
}

//锚点审核-地址忽略
export function SetIgnore(data) {
  return request({
    url: '/ibs/anchor/SetIgnore',
    method: 'post',
    data: data
  })
}

//已忽略地址重新审核
export function ReAudit(data) {
  return request({
    url: '/ibs/anchor/ReAudit',
    method: 'post',
    data: data
  })
}

//已忽略地址删除
export function DelIgnore(data) {
  return request({
    url: '/ibs/anchor/DelIgnore',
    method: 'post',
    data: data
  })
}

export function SetIgnoreUp(data) {
  return request({
    url: '/ibs/anchor/SetIgnoreUp',
    method: 'post',
    data: data
  })
}

// 导出
export function exportModel(params) {
  return request({
    url: `/ibs/anchor/exportQyModel`,
    method: 'get',
    responseType: 'blob',
    timeout: 30000,
    params: params
  })
}

export function exportPersonModel(params) {
  return request({
    url: `/ibs/anchor/exportPersonModel`,
    method: 'get',
    responseType: 'blob',
    timeout: 30000,
    params: params
  })
}

// 查询用户个人信息
export function getUserProfile() {
  return request({
    url: '/system/user/profile',
    method: 'get'
  })
}

export function addressStandardize(params) {
  return request({
    url: '/address/analyse/addressStandardize1',
    method: 'get',
    params
  })
}

//刷新提升
export function refresh(userid, custType) {
  return request({
    url: `/ibs/anchor/refresh?userid=${userid}&custType=${custType}`,
    method: 'post'
  })
}

export function addAnchor(data) {
  return request({
    url: '/ibs/anchor/addAnchor',
    method: 'post',
    data: data
  })
}

export function importDataBySelect(data) {
  return request({
    url: '/system/group/importDataBySelect',
    method: 'post',
    data: data
  })
}

export function isGroupNameRepeat(params) {
  return request({
    url: '/system/group/isGroupNameRepeat',
    method: 'get',
    params
  })
}

export function returnGrModel(data) {
  return request({
    url: '/ibs/anchor/returnGrModel',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: data
  })
}

export function returnQyModel(data) {
  return request({
    url: '/ibs/anchor/returnQyModel',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: data
  })
}
