罗广辉
2025-06-19 f27ca082eb0a839449dd50c49007b58e5ed6946f
src/api/device-cmd/index.ts
@@ -1,5 +1,14 @@
/*
 * @Author: GuLiMmo 2820890765@qq.com
 * @Date: 2024-03-12 17:59:03
 * @LastEditors: GuLiMmo 2820890765@qq.com
 * @LastEditTime: 2024-08-28 14:25:29
 * @FilePath: /drone-web/src/api/device-cmd/index.ts
 * @Description:
 * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
 */
import request, { IWorkspaceResponse } from '/@/api/http/request'
import { DeviceCmd } from '/@/types/device-cmd'
import { DeviceCmd, DeviceCmdItemAction } from '/@/types/device-cmd'
const CMD_API_PREFIX = '/control/api/v1'
@@ -8,13 +17,16 @@
  device_cmd: DeviceCmd // 指令
}
export interface PostSendCmdBody {
  action: DeviceCmdItemAction
}
/**
 * 发送机场控制指令
 * @param params
 * @returns
 */
// /control/api/v1/devices/{dock_sn}/jobs/{service_identifier}
export async function postSendCmd (params: SendCmdParams): Promise<IWorkspaceResponse<{}>> {
  const resp = await request.post(`${CMD_API_PREFIX}/devices/${params.dock_sn}/jobs/${params.device_cmd}`)
export async function postSendCmd (params: SendCmdParams, body?: PostSendCmdBody): Promise<IWorkspaceResponse<{}>> {
  const resp = await request.post(`${CMD_API_PREFIX}/devices/${params.dock_sn}/jobs/${params.device_cmd}`, body)
  return resp.data
}