import request from '@/utils/request'

export function _getRates() {
  return request({
    url: '/FinanceCustomerRate/GetRates',
    method: 'get'
  })
}

export function _addRate(data) {
  var r = request({
    timeout: 60000,
    url: '/FinanceCustomerRate/AddRate',
    method: 'post',
    data
  })
  clearCache()
  return r
}

export function _editRate(data) {
  var r = request({
    timeout: 60000,
    url: '/FinanceCustomerRate/EditRate',
    method: 'post',
    data
  })
  clearCache()
  return r
}

function clearCache() {
  request({
    url: 'http://47.244.232.78/api/Customer/ClareCaches',
    method: 'post'
  })
  request({
    url: 'http://120.24.149.148/api/Customer/ClareCaches',
    method: 'post'
  })
}
