import  reqeust  from 'request.js'
import  reqeust1  from 'request1.js'
// 本地环境 
  //  const Url = "http://192.168.0.104:81/ApiWx/";

  // const Url = "http://localhost:56306/ApiWx/";

// 生产环境  

const Url = "https://auth.blv-oa.com/ApiWx/";
const BoonliveUrl = "https://auth.blv-oa.com/Upgrade/";
// 测试环境  
 //const Url = "http://auth.blv-oa.com:996/ApiWx/";
  const appid = 5;

var token = null
//获取token
function gettoken(){          
 if (token == null) {
    token = wx.getStorageSync('xiaoxi_token') || ""
  }
  return token;
}
export function settoken(val) {
  token = val;
}
//账号密码登录
export async function Login(params) {
  token = null;
  params.appid = appid
  return await reqeust({
    title: "登录中",
    url: Url + 'Login',
    data: params || {}
  })
};
//token登录
export async function LoginToken(params) {
  token = null;
  params.appid = appid
  return await reqeust({
    title: "登录中",
    url: Url + 'LoginToken',
    data: params || {}
  })
}
//获取酒店信息
export async function GetHostsInfo(params) {
  params.appid = appid
  params.token = gettoken();
  return await reqeust({
    title: "加载中...",
    url: Url + 'HostsInfo',
    data: params || {}
  })
}
//绑定Mac地址
export async function GetMAC(params) {
  params.token = gettoken();
  return await reqeust({
    title: params.MAC == "" ? "解绑中..." : "绑定中...",
    url: Url + 'GetMAC',
    data: params || {}
  })
}
// 日志信息
export async function Logsinfo(params) {
  params.token = gettoken();
  return await reqeust({
    title: "加载中...",
    url: Url + 'Logsinfo',
    data: params || {}
  })
}
// 反馈错误
export async function ErrorInfo(params) {
  params.token = gettoken();
  return await reqeust({
    title: "反馈中...",
    url: Url + 'ErrorInfo',
    data: params || {}
  })
}
// 查询人脸机是否绑定
export async function CheckFaceSN(params) {
  params.token = gettoken();
  return await reqeust({
    title:"查询中...",
    url: Url + 'CheckFaceSN',
    data: params || {}
  })
}
// 绑定人脸机 
export async function GetFaceSN(params) {
  params.token = gettoken();
  return await reqeust({
    title: params.isjb   ? "解绑中..." : "绑定中...",
    url: Url + 'GetFaceSN',
    data: params || {}
  })
}
//开门测试
export async function OpenDoorTest(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发开门命令中",
    url: Url + 'OpenDoorTest',
    data: params || {}
  })
}
//重启测试
export async function RestartTheDevice(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发重启命令中",
    url: Url + 'RestartTheDevice',
    data: params || {}
  })
}
//获取设备信息测试

export async function GeteDeviceInfomation(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发获取设备信息命令中",
    url: Url + 'GeteDeviceInfomation',
    data: params || {}
  })
}
//删除所有住户人员信息

export async function DeletePeopleFromDeviceByGroup(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发删除所有住户人员信息命令中",
    url: Url + 'DeletePeopleFromDeviceByGroup',
    data: params || {}
  })
}

export async function GetThePeopleListOfDevice(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "获取人员信息列表",
    url: Url + 'GetThePeopleListOfDevice',
    data: params || {}
  })
}
//开房
export async function openRommCheckin(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发开房命令",
    url: Url + 'openRommCheckin',
    data: params || {}
  })
}

//退房
export async function roomCheckOut(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "下发退房命令",
    url: Url + 'roomCheckOut',
    data: params || {}
  })
}
//获取房型
export async function GetRoomType(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust({
    title: "获取酒店房型信息",
    url: Url + 'GetRoomTypeAndModalsList',
    data: params || {}
  })
}
//获取房型下的房间
export async function GetRoomTypeNode(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "获取酒店房间信息",
    url: BoonliveUrl + 'GetDeviceInfo',
    data: params || {}
  })
}
//获取房型下的设备
export async function GetRoomAddressStatus(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "",
    url: BoonliveUrl + 'GetRoomAddressStatus',
    data: params || {}
  })
}
  export async function WebChatUpgrade(params){
    
    params.token = gettoken();
    console.log(params)
    return await reqeust1({
      title: "准备设备升级",
      url: BoonliveUrl + 'WebChatUpgrade',
      data: params || {}
    })
}
export async function GetRoomTypeAndModalsListLog(params){
    
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "获取房间配置回路信息",
    url: BoonliveUrl + 'GetRoomTypeAndModalsListLog',
    data: params || {}
  })
}
export async function QueryUpdateHostStatus(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'QueryUpdateHostStatus',
    data: params || {}
  })
}
export async function ForwardQueryUpdateHostProgressBar(params){
  params.token = gettoken();
  // console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'ForwardQueryUpdateHostProgressBar',
    data: params || {}
  })
}
export async function SetRCULight(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'SetRCULight',
    data: params || {}
  })
}
export async function SetRCUAir(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'SetRCUAir',
    data: params || {}
  })
}
export async function SetRCUCurtain(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'SetRCUCurtain',
    data: params || {}
  })
}

//查询设备列表
export async function QueryDeviceList(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'QueryDeviceList',
    data: params || {}
  })
}

//设置RCU服务
export async function SetRCUService(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: null,
    url: BoonliveUrl + 'SetRCUService',
    data: params || {}
  })
}

//写入房间设备访问日志
export async function WriteRoomVisitLog(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "上传查房记录中",
    url: BoonliveUrl + 'WriteRoomVisitLog',
    data: params || {}
  })
}

//查询房间设备访问日志
export async function QueryRoomVisitLog(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "查询设备访问日志中",
    url: BoonliveUrl + 'QueryRoomVisitLog',
    data: params || {}
  })
}

//修改房间设备访问日志
export async function UpdateRoomVisitLog(params){
  params.token = gettoken();
  console.log(params)
  return await reqeust1({
    title: "更新故障记录中",
    url: BoonliveUrl + 'UpdateRoomVisitLog',
    data: params || {}
  })
}