import request from '@/utils/request'

// application/x-www-form-urlencoded表单形式
function urlencoded(data) {
  const newData = Object.keys(data).map((key) => {
    return `${key}=${encodeURIComponent(data[key])}`
  }).join('&')
  return newData
}

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

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