/**
登录数据访问层，用户接口不能通过页面直接调用，先注入Store全局管理
*/
import request from '../utils/request'

export function login({
  Account,
  Password,
  AutoLoginId
}) {
  AutoLoginId = AutoLoginId ? AutoLoginId : 0
  // headers: {
  //     'Content-Type': 'application/json;charset=UTF-8'
  // }, 申明Headers信息，不包含token ,token通过注入添加
  return request({
    url: '/login/login',
    method: "post",
    // header,
    data: {
      Account,
      Password,
      AccountType: 1,
      AutoLoginId
    }
  });
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    data: {}
  })
}

export function getSeatNewToken() {
  return request({
    url: '/user/GetSeatNewToken',
    method: 'post',
    data: {}
  })
}

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

export function loginByWeChat({
  AutoLoginWorkId,
  AutoLoginOpenId
}) {
  return request({
    url: '/login/login',
    method: "post",
    // header,
    data: {
      Account: '',
      Password: '',
      AccountType: 1,
      AutoLoginId: 0,
      AutoLoginWorkId,
      AutoLoginOpenId
    }
  });
}

export function setUserCodeCallBack(data) {
  return request({
    url: '/QYWeChat/SetUserCodeCallBack',
    method: 'post',
    data
  })
}

export function setUserAutoLogin(data) {
    return request({
        url: '/QYWeChat/SetUserAutoLogin',
        method: 'post',
        data
    })
}