import request from '@/utils/request'
import { getSession } from '@/utils/sessionStorage'
import { encryption } from '@/utils/aes'
import { aesKey } from "@/utils/config";
// Register
export function Register(data) {
  return request({
    url: '/Public/Register',
    headers: {
      authorization: getSession('phoneToken')
    },
    method: 'post',
    data
  })
}

// recoverPassword
export function recoverPassword(data) {
  return request({
    url: '/Public/recoverPassword',
    headers: {
      authorization: getSession('phoneToken')
    },
    method: 'post',
    data
  })
}

// login
export function login(data) {
  return request({
    url: '/Public/Login',
    method: 'post',
    data
  })
}

// getVerifyCode
export function getVerifyCode(data) {
  var data1 = {
    ...data
  }
  data1.sign = encryption((data.account+data.type+data.action).toLowerCase(), aesKey)
  return request({
    url: '/Public/getVerifyCode',
    method: 'post',
    data: data1
  })
}

// 退出登录
export function logOut(data) {
  return request({
    url: '/LogOut',
    method: 'post',
    data
  })
}

// 校验验证码
export function setSecurityVerify(data) {
  return request({
    url: '/setSecurityVerify',
    method: 'post',
    data
  })
}
