import request from "@/request/index";
  
export function GetBoatNum(id) {
  return request({
    url: '/DigitalTwain/dredging/getDredgingShipNum',
    method: "post",
    data: {id}
  })
}

export function GetFstj(id) {
  return request({
    url: '/DigitalTwain/dredging/getDredgingByTime',
    method: "post",
    data: {
      id
    }
  })
}
export  function  getDredgingShip(data) {
  return request({
    url: '/DigitalTwain/dredging/getDredgingShip',
    method: "post",
    data:data
  })
}


export function GetFstjByDay(time, id) {
  return request({
    url: '/DigitalTwain/dredging/getShipListByDays',
    method: "post",
    data: {
      time, id
    }
  })
}

export function GetYjWarning(index,size,id) {
  return request({
    url: '/DigitalTwain/dredging/getCrossWarning',
    method: "post",
    data: {
      page: index, limit:size, id
    }
  })
}

export function GetGctj() {
  return request({
    url: '/DigitalTwain/dredging/workCountByYear',
    method: "post"
  })
}

export function GetGcxx(year) {
  return request({
    url: '/DigitalTwain/dredging/projectInfo',
    method: "post",
    data: {
      year
    }
  })
}
// export function GetGcxx(year) {
//   return request({
//     url: '/DigitalTwain/dredging/projectInfo',
//     method: "post",
//     data: {
//       year
//     }
//   })
// }

export function GetWhss() {
  return request({
    url: '/DigitalTwin/WaterDepthSpace/getHpjArea',
    method: "post"
  })
}

export function GetHpjDepthPoints(data) {
  return request({
    url: '/DigitalTwin/GetHpjDepthPointsByExtent',
    method: "post",
    data: data
  })
}

export function GetVideoToken() {
  return new Promise((resolve, reject) => {
    request({
      method: 'post',
      headers: {
        "Content-Type": "application/x-www-form-urlencoded",
      },
      url: 'https://proj.bim-ace.com:10260/connect/token',
      data: {
        client_id: '5da87851cb5c444283424fa6f7b2fe6b',
        client_secret: '50f28c2d97e54f55bf837053b0aa3790',
        scope: 'DataCenterV2',
        grant_type: 'client_credentials',
      }
    }).then(res => {
      request({
        method: 'get',
        url: 'https://proj.bim-ace.com:10207/services/api/data-center/ys7/subAccessToken',
        headers: {
          Authorization: 'Bearer ' + res.access_token
        },
        params: {
          Id: '0430554C-B95A-4F24-94E8-AEE9B27B3A08',
          AccountId: 'c8922f0994664497a78a20ced154a036',
        }
      }).then(res => {
        resolve(res)
      }).catch((e) => {
        reject({ msg: 'accessToken获取失败' })
      })
    }).catch((e) => {
      reject({ msg: '安全认证未通过' })
    })
  })
}
