import request from "../request";


// 账户登录方法
export function login(username, password, code, uuid) {
    const data = {
      username,
      password,
      code,
      uuid
    }
    return request({
      url: '/login',
      method: 'post',
      data: data
    })
  }
  
  // 账户不需要验证码登录方法
  export function nameLogin(username, password) {
    const data = {
      username,
      password,   
    }
    return request({
      url: '/nameLogin',
      method: 'post',
      data: data
    })
  }
  
  // 手机登录方法
  export function phoneLogin(mobile, code, uuid) {
    const data = {
      mobile,
      code,
      uuid
    }
    return request({
      url: '/phoneLogin',
      method: 'post',
      data: data
    })
  }
  
  // 获取用户详细信息
  export function getInfo() {
    return request({
      url: '/getInfo',
      method: 'get'
    })
  }
  
  // 退出方法
  export function logout() {
    return request({
      url: '/logout',
      method: 'post'
    })
  }
  
  // 获取验证码
  export function getCodeImg() {
    return request({
      url: '/captchaImage',
      method: 'get'
    })
  }
  
  // 获取前台用户注册短信验证码
  export function getCodeUserRegister(phoneNumber) {
    return request({
      url: '/captchaUserRegister?phoneNumber=' + phoneNumber,
      method: 'get'
    })
  }
  
  // 获取前台用户注册登录验证码
  export function getCodeUserLogin(phoneNumber) {
    return request({
      headers: {
        isToken: false
      },
      url: '/captchaUserLogin?phoneNumber=' + phoneNumber,
      method: 'get'
    })
  }
  
  // 获取前台用户修改密码短信验证码
  export function getCodeChangePasswd(phoneNumber) {
    return request({
      url: '/captchaChangePasswd?phoneNumber=' + phoneNumber,
      method: 'get'
    })
  }
  //设置交易密码  
  export function scatpasswd(userId,data) {
    return request({
      url: `/mpay/setpasswd/${userId}`,
      method: 'post',
      data: data
    })
  }