import $axios from '../index'

const userApi = {
  myInfoApi: '/api/user/info/my',
  userInfoApi: '/api/user/info',
  vipPlanApi: '/api/user/vip/plan',
  vipOrderApi: '/api/user/vip/order',
  vipPayApi: '/api/user/vip/pay'
}

export function getMyInfo() {
  return $axios.get(userApi.myInfoApi)
}

export function getUserInfo(userId) {
  return $axios.get(userApi.userInfoApi + '?userId=' + userId)
}

export function getVipPlan() {
  return $axios.get(userApi.vipPlanApi)
}

export function getVipOrder() {
  return $axios.get(userApi.vipOrderApi)
}

export function createVipOrder(planId) {
  return $axios.post(userApi.vipOrderApi + '/' + planId)
}

export function payVip(orderId) {
  return $axios.post(userApi.vipPayApi + '/' + orderId)
}
