import fly from "./main";

// 设备列表
export function game_devices($params = {}) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/device-list", $params);
}

// 开始游戏
export function gameStart($params) {
  return fly.post("game/game-start", $params);
}

//结束游戏
export function gameEnd($params) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/game-over", $params);
}

//游戏记录详情
export function gameDetail($record_id) {
  let $params = {};
  $params["game_record_id"] = $record_id;
  // $params["game_record_id"] = "9389";
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/game-detail", $params);
}

//折线图图表
export function gameLineChart($params) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/line", $params);
}

// 添加折线图的点
export function gameAddLine($params) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/add-line", $params);
}

//获取游戏记录
export function gameList($params = {}) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/game-list", $params);
}

//2021年10月21日15:08:57
//获取设备
export function getDeviceBySn($sn) {
  let $params = {
    "access_token": wx.getStorageSync("token"),
    "sn": $sn
  }
  return fly.post("equipment/equipment-search", $params)
}

//todo 获取最新脑机数据包信息
export function getFirmwareVersion() {
  let $params = {
    "access_token": wx.getStorageSync("token"),
  }
  return fly.post("firmware/firmware-info", $params)
}

//todo 提交 脑机与版本
export function EditFirmwareVersion(sn,version) {
  let $params = {
    "access_token": wx.getStorageSync("token"),
    sn,version
  }
  return fly.post("equipment/edit", $params)
}

//todo 添加原始数据
export function addRawData($params) {
  $params["access_token"] = wx.getStorageSync("token");
  return fly.post("game/edit-raw", $params);
}
